@ndla/ui 50.11.3 → 50.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,6 @@
8
8
 
9
9
  import { FocusEvent, MouseEvent, RefObject } from "react";
10
10
  import { useTranslation } from "react-i18next";
11
- import { css } from "@emotion/react";
12
11
  import styled from "@emotion/styled";
13
12
  import { ButtonV2, IconButtonV2 } from "@ndla/button";
14
13
  import { colors, spacing, mq, breakpoints, misc, fonts } from "@ndla/core";
@@ -17,10 +16,6 @@ import { Search as SearchIcon } from "@ndla/icons/common";
17
16
  import ActiveFilters from "./ActiveFilters";
18
17
  import LoadingWrapper from "./LoadingWrapper";
19
18
 
20
- interface StyledInputProps {
21
- hasFilters?: boolean;
22
- }
23
-
24
19
  const SearchButton = styled(IconButtonV2)`
25
20
  position: absolute;
26
21
  padding: ${spacing.small};
@@ -45,6 +40,14 @@ const InputWrapper = styled.div`
45
40
  display: flex;
46
41
  align-items: center;
47
42
  flex-flow: row-reverse;
43
+ border: 1px solid ${colors.brand.greyLight};
44
+ border-radius: ${misc.borderRadius};
45
+
46
+ &:active,
47
+ &:hover {
48
+ border: 1px solid ${colors.brand.primary};
49
+ }
50
+
48
51
  ${mq.range({ from: breakpoints.tablet })} {
49
52
  position: relative;
50
53
  padding: 0;
@@ -55,9 +58,6 @@ const FiltersWrapper = styled.div`
55
58
  display: flex;
56
59
  height: ${spacing.large};
57
60
  background: ${colors.white};
58
- border-top-left-radius: ${misc.borderRadius};
59
- border-bottom-left-radius: ${misc.borderRadius};
60
- border: 1px solid ${colors.brand.greyLight};
61
61
  padding-left: ${spacing.small};
62
62
  padding-right: 0;
63
63
  border-right: 0;
@@ -72,48 +72,24 @@ const FiltersWrapper = styled.div`
72
72
  }
73
73
  `;
74
74
 
75
- const StyledInput = styled.input<StyledInputProps>`
75
+ const StyledInput = styled.input`
76
76
  width: 100%;
77
- height: 48px;
77
+ height: ${spacing.large};
78
78
  line-height: 28px;
79
- border: 1px solid ${colors.brand.greyLight};
80
- border-radius: ${misc.borderRadius};
79
+ margin: 2px;
80
+ border: 0px;
81
+ &[data-has-filters="true"] {
82
+ border-left: 0px;
83
+ }
81
84
  padding-right: ${spacing.large};
82
- padding-left: ${spacing.normal};
85
+ padding-left: ${spacing.small};
83
86
  flex-grow: 1;
84
87
  outline: 0;
85
- &:focus,
86
- &:hover {
87
- border-color: ${colors.brand.primary};
88
- }
89
-
90
88
  ${mq.range({ from: breakpoints.tablet })} {
91
89
  height: 58px;
92
90
  line-height: 58px;
93
91
  ${fonts.sizes("18px", "24px")};
94
92
  }
95
-
96
- ${(p) =>
97
- p.hasFilters &&
98
- css`
99
- ${mq.range({ from: breakpoints.desktop })} {
100
- padding-left: ${spacing.normal};
101
- }
102
- padding-left: 0;
103
- border-left: 0;
104
- border-top-left-radius: 0;
105
- border-bottom-left-radius: 0;
106
-
107
- &:focus {
108
- border: 1px solid ${colors.brand.primary};
109
- border-left: 0;
110
-
111
- & + .c-search-field__filters {
112
- border: 1px solid ${colors.brand.primary};
113
- border-right: 0;
114
- }
115
- }
116
- `};
117
93
  `;
118
94
 
119
95
  interface Props {
@@ -151,7 +127,7 @@ const SearchField = ({
151
127
  <InputWrapper>
152
128
  {loading && <LoadingWrapper value={value} />}
153
129
  <StyledInput
154
- hasFilters={!!filters?.length}
130
+ data-has-filters={!!filters?.length}
155
131
  ref={inputRef}
156
132
  type="search"
157
133
  aria-autocomplete="list"
@@ -30,7 +30,7 @@ const Container = styled.div`
30
30
  const targetResource: TreeStructureProps["targetResource"] = {
31
31
  id: "test-resource",
32
32
  resourceId: "123",
33
- resourceType: "type",
33
+ resourceType: "concept",
34
34
  tags: [],
35
35
  path: "",
36
36
  created: "",