@julseb-lib/react 0.0.30 → 0.0.32
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.
- package/README.md +1 -1
- package/dist/index.cjs.js +365 -363
- package/dist/index.es.js +2428 -2420
- package/dist/index.umd.js +409 -407
- package/dist/lib/components/Header/Header.tsx +10 -1
- package/dist/lib/components/Header/styles.tsx +23 -16
- package/dist/lib/components/Header/types.ts +18 -2
- package/package.json +1 -1
|
@@ -26,7 +26,6 @@ import type {
|
|
|
26
26
|
* @prop logo: LibHeaderLogo
|
|
27
27
|
* @prop links: Array<LibHeaderLink> => only if children is not defined
|
|
28
28
|
* @prop children?: ReactChildren => only if links is not defined
|
|
29
|
-
* @prop variant?: LibHeaderVariant
|
|
30
29
|
* @prop burgerPosition?: LibNavBurgerPosition
|
|
31
30
|
* @prop burgerColor?: "primary" | "secondary" | "success" | "danger" | "warning" | "white" | "gray" | "font" | "background" { closed: "primary" | "secondary" | "success" | "danger" | "warning" | "white" | "gray" | "font" | "background"; open: "primary" | "secondary" | "success" | "danger" | "warning" | "white" | "gray" | "font" | "background" }
|
|
32
31
|
* @prop navDesktopVariant?: LibNavBurgerPosition
|
|
@@ -35,6 +34,10 @@ import type {
|
|
|
35
34
|
* @prop search?: { pathname: string; queries?: Array<Array<string>>; iconLeft?: string | JSX.Element; iconLeftSize?: number; iconClear?: string | JSX.Element; iconClearSize?: number; iconBaseUrl?: string; placeholder?: string; keyboardShortcut?: Array<string>; showKeys?: boolean; inputBackground?: "light" | "dark"; maxWidth?: string | number; inputVariant?: "rounded" | "pill" }
|
|
36
35
|
* @prop position?: LibHeaderPosition
|
|
37
36
|
* @prop hideOnScroll?: boolean | number => only if position is set to fixed
|
|
37
|
+
* @prop variant?: "primary" | "white" | "transparent"
|
|
38
|
+
* @prop backgroundColor?: Any color from the library => only if variant is set to primary
|
|
39
|
+
* @prop textColor?: Any color from the library => only if variant is set to primary
|
|
40
|
+
* @prop linkColor?: "primary" | "secondary" | "success" | "danger" | "warning" | "white" | "gray" | "font"
|
|
38
41
|
*/
|
|
39
42
|
export const Header = forwardRef<HTMLDivElement, ILibHeader>(
|
|
40
43
|
(
|
|
@@ -54,6 +57,9 @@ export const Header = forwardRef<HTMLDivElement, ILibHeader>(
|
|
|
54
57
|
links,
|
|
55
58
|
nav,
|
|
56
59
|
enableScrollingOpen,
|
|
60
|
+
backgroundColor = "primary",
|
|
61
|
+
textColor = "background",
|
|
62
|
+
linkColor = "white",
|
|
57
63
|
...rest
|
|
58
64
|
},
|
|
59
65
|
ref
|
|
@@ -159,6 +165,9 @@ export const Header = forwardRef<HTMLDivElement, ILibHeader>(
|
|
|
159
165
|
$headerHeight={headerHeight}
|
|
160
166
|
$position={position}
|
|
161
167
|
$variant={variant}
|
|
168
|
+
$backgroundColor={backgroundColor}
|
|
169
|
+
$linkColor={linkColor}
|
|
170
|
+
$textColor={textColor}
|
|
162
171
|
{...rest}
|
|
163
172
|
>
|
|
164
173
|
{burgerPosition === "left" && <HeaderBurger {...burgerProps} />}
|
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
LINE_HEIGHTS,
|
|
18
18
|
} from "../../"
|
|
19
19
|
import type {
|
|
20
|
+
LibAllColors,
|
|
21
|
+
LibColorsHover,
|
|
20
22
|
LibHeaderPosition,
|
|
21
23
|
LibHeaderVariant,
|
|
22
24
|
LibNavBurgerPosition,
|
|
@@ -27,7 +29,7 @@ const LogoImg = styled(Image).attrs({ fit: "contain" })`
|
|
|
27
29
|
object-position: left center;
|
|
28
30
|
position: relative;
|
|
29
31
|
z-index: 999;
|
|
30
|
-
`
|
|
32
|
+
` as any
|
|
31
33
|
|
|
32
34
|
const Logo = styled(Link)`
|
|
33
35
|
position: relative;
|
|
@@ -49,6 +51,9 @@ const StyledHeader = styled.header<{
|
|
|
49
51
|
$burgerPosition: LibNavBurgerPosition
|
|
50
52
|
$position: LibHeaderPosition
|
|
51
53
|
$headerHeight: number
|
|
54
|
+
$backgroundColor: LibAllColors
|
|
55
|
+
$textColor: LibAllColors
|
|
56
|
+
$linkColor: LibColorsHover
|
|
52
57
|
}>`
|
|
53
58
|
position: ${({ $position }) => $position};
|
|
54
59
|
left: 0;
|
|
@@ -62,6 +67,9 @@ const StyledHeader = styled.header<{
|
|
|
62
67
|
})};
|
|
63
68
|
padding: ${SPACERS.M} 5vw;
|
|
64
69
|
transition: ${TRANSITIONS.SHORT};
|
|
70
|
+
background-color: ${({ $backgroundColor }) =>
|
|
71
|
+
Mixins.AllColors($backgroundColor)};
|
|
72
|
+
color: ${({ $textColor }) => Mixins.AllColors($textColor)};
|
|
65
73
|
|
|
66
74
|
@media ${BREAKPOINTS.MOBILE} {
|
|
67
75
|
height: ${({ $headerHeight }) => $headerHeight}px;
|
|
@@ -103,7 +111,7 @@ const StyledHeader = styled.header<{
|
|
|
103
111
|
}
|
|
104
112
|
`}
|
|
105
113
|
|
|
106
|
-
${({ $variant }) =>
|
|
114
|
+
${({ $variant, $linkColor }) =>
|
|
107
115
|
($variant === "white" || $variant === "transparent") &&
|
|
108
116
|
css`
|
|
109
117
|
& > a,
|
|
@@ -111,28 +119,28 @@ const StyledHeader = styled.header<{
|
|
|
111
119
|
& > nav > a,
|
|
112
120
|
& > nav > button {
|
|
113
121
|
color: ${({ theme }) =>
|
|
114
|
-
Mixins.ColorsHoverDefault(
|
|
122
|
+
Mixins.ColorsHoverDefault($linkColor, theme)};
|
|
115
123
|
|
|
116
124
|
@media ${BREAKPOINTS.HOVER} {
|
|
117
125
|
&:hover {
|
|
118
126
|
color: ${({ theme }) =>
|
|
119
|
-
Mixins.ColorsHoverHover(
|
|
127
|
+
Mixins.ColorsHoverHover($linkColor, theme)};
|
|
120
128
|
}
|
|
121
129
|
|
|
122
130
|
&:active {
|
|
123
131
|
color: ${({ theme }) =>
|
|
124
|
-
Mixins.ColorsHoverActive(
|
|
132
|
+
Mixins.ColorsHoverActive($linkColor, theme)};
|
|
125
133
|
}
|
|
126
134
|
}
|
|
127
135
|
}
|
|
128
136
|
|
|
129
137
|
& > ${Logo} {
|
|
130
138
|
color: ${({ theme }) =>
|
|
131
|
-
Mixins.ColorsHoverDefault(
|
|
139
|
+
Mixins.ColorsHoverDefault($linkColor, theme)};
|
|
132
140
|
}
|
|
133
141
|
`}
|
|
134
142
|
|
|
135
|
-
${({ $variant, theme }) => {
|
|
143
|
+
${({ $variant, theme, $backgroundColor, $textColor, $linkColor }) => {
|
|
136
144
|
switch ($variant) {
|
|
137
145
|
case "white":
|
|
138
146
|
return css`
|
|
@@ -181,30 +189,29 @@ const StyledHeader = styled.header<{
|
|
|
181
189
|
`
|
|
182
190
|
case "primary":
|
|
183
191
|
return css`
|
|
184
|
-
background-color: ${
|
|
185
|
-
|
|
192
|
+
background-color: ${Mixins.AllColors(
|
|
193
|
+
$backgroundColor,
|
|
194
|
+
theme
|
|
195
|
+
)};
|
|
196
|
+
color: ${Mixins.AllColors($textColor, theme)};
|
|
186
197
|
|
|
187
198
|
& > a,
|
|
188
199
|
& > button:not(${StyledHeaderBurger}),
|
|
189
200
|
& > nav > a,
|
|
190
201
|
& > nav > button,
|
|
191
202
|
& > ${Logo} {
|
|
192
|
-
color: ${(
|
|
193
|
-
Mixins.ColorsHoverDefault("background", theme)};
|
|
203
|
+
color: ${Mixins.ColorsHoverDefault($linkColor, theme)};
|
|
194
204
|
|
|
195
205
|
@media ${BREAKPOINTS.HOVER} {
|
|
196
206
|
&:hover {
|
|
197
207
|
color: ${({ theme }) =>
|
|
198
|
-
Mixins.ColorsHoverHover(
|
|
199
|
-
"background",
|
|
200
|
-
theme
|
|
201
|
-
)};
|
|
208
|
+
Mixins.ColorsHoverHover($linkColor, theme)};
|
|
202
209
|
}
|
|
203
210
|
|
|
204
211
|
&:active {
|
|
205
212
|
color: ${({ theme }) =>
|
|
206
213
|
Mixins.ColorsHoverActive(
|
|
207
|
-
|
|
214
|
+
$linkColor,
|
|
208
215
|
theme
|
|
209
216
|
)};
|
|
210
217
|
}
|
|
@@ -12,12 +12,12 @@ import type {
|
|
|
12
12
|
ReactChildren,
|
|
13
13
|
LibHeaderVariant,
|
|
14
14
|
LibColorsHover,
|
|
15
|
+
LibAllColors,
|
|
15
16
|
} from "../../types"
|
|
16
17
|
import type { LibHeaderLogo } from "./subtypes"
|
|
17
18
|
|
|
18
19
|
interface ILibHeaderBase extends LibComponentBase<HTMLDivElement> {
|
|
19
20
|
logo: LibHeaderLogo
|
|
20
|
-
variant?: LibHeaderVariant
|
|
21
21
|
burgerPosition?: LibNavBurgerPosition
|
|
22
22
|
burgerColor?:
|
|
23
23
|
| LibColorsHover
|
|
@@ -72,4 +72,20 @@ type HeaderWithChildren = HeaderPosition & {
|
|
|
72
72
|
children?: ReactChildren
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
type LibHeaderChildren = HeaderWithLinks | HeaderWithNav | HeaderWithChildren
|
|
76
|
+
|
|
77
|
+
type HeaderWithBackground = LibHeaderChildren & {
|
|
78
|
+
variant?: Extract<LibHeaderVariant, "primary">
|
|
79
|
+
backgroundColor?: LibAllColors
|
|
80
|
+
textColor?: LibAllColors
|
|
81
|
+
linkColor?: LibColorsHover
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
type HeaderWithoutBackground = LibHeaderChildren & {
|
|
85
|
+
variant?: Exclude<LibHeaderVariant, "primary">
|
|
86
|
+
backgroundColor?: never
|
|
87
|
+
textColor?: never
|
|
88
|
+
linkColor?: never
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export type ILibHeader = HeaderWithBackground | HeaderWithoutBackground
|