webcoreui 0.0.11 → 0.0.12
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 +33 -7
- package/astro.d.ts +4 -0
- package/astro.js +4 -0
- package/components/Accordion/Accordion.astro +10 -8
- package/components/Accordion/Accordion.svelte +8 -8
- package/components/Accordion/Accordion.tsx +7 -6
- package/components/Accordion/{accordion.scss → accordion.module.scss} +18 -10
- package/components/Alert/Alert.astro +11 -7
- package/components/Alert/Alert.svelte +9 -7
- package/components/Alert/Alert.tsx +11 -7
- package/components/Alert/alert.module.scss +54 -0
- package/components/Alert/alert.ts +3 -1
- package/components/Avatar/Avatar.astro +4 -4
- package/components/Avatar/Avatar.svelte +13 -7
- package/components/Avatar/Avatar.tsx +11 -9
- package/components/Avatar/{avatar.scss → avatar.module.scss} +2 -2
- package/components/Badge/Badge.astro +8 -8
- package/components/Badge/Badge.svelte +25 -13
- package/components/Badge/Badge.tsx +26 -8
- package/components/Badge/badge.module.scss +89 -0
- package/components/Badge/badge.ts +8 -1
- package/components/Button/Button.astro +10 -6
- package/components/Button/Button.svelte +15 -11
- package/components/Button/Button.tsx +11 -7
- package/components/Button/button.module.scss +94 -0
- package/components/Button/button.ts +6 -1
- package/components/Card/Card.astro +7 -15
- package/components/Card/Card.svelte +16 -13
- package/components/Card/Card.tsx +15 -11
- package/components/Card/card.module.scss +33 -0
- package/components/Checkbox/Checkbox.astro +10 -10
- package/components/Checkbox/Checkbox.svelte +19 -18
- package/components/Checkbox/Checkbox.tsx +12 -11
- package/components/Checkbox/{checkbox.scss → checkbox.module.scss} +16 -17
- package/components/Checkbox/checkbox.ts +5 -1
- package/components/ConditionalWrapper/ConditionalWrapper.svelte +1 -1
- package/components/Icon/Icon.svelte +1 -8
- package/components/Icon/Icon.tsx +1 -8
- package/components/Icon/map.ts +23 -0
- package/components/Input/Input.astro +50 -52
- package/components/Input/Input.svelte +52 -52
- package/components/Input/Input.tsx +59 -59
- package/components/Input/{input.scss → input.module.scss} +87 -83
- package/components/Input/input.ts +8 -2
- package/components/Menu/Menu.astro +107 -0
- package/components/Menu/Menu.svelte +88 -0
- package/components/Menu/Menu.tsx +107 -0
- package/components/Menu/menu.module.scss +144 -0
- package/components/Menu/menu.ts +21 -0
- package/components/Progress/Progress.astro +42 -40
- package/components/Progress/Progress.svelte +40 -38
- package/components/Progress/Progress.tsx +48 -47
- package/components/Progress/{progress.scss → progress.module.scss} +66 -66
- package/components/Radio/Radio.astro +57 -57
- package/components/Radio/Radio.svelte +58 -56
- package/components/Radio/Radio.tsx +69 -68
- package/components/Radio/{radio.scss → radio.module.scss} +92 -92
- package/components/Radio/radio.ts +4 -0
- package/components/Rating/Rating.astro +13 -10
- package/components/Rating/Rating.svelte +15 -15
- package/components/Rating/Rating.tsx +22 -11
- package/components/Rating/{rating.scss → rating.module.scss} +10 -9
- package/components/Rating/rating.ts +1 -1
- package/components/Spinner/Spinner.astro +44 -42
- package/components/Spinner/Spinner.svelte +40 -38
- package/components/Spinner/Spinner.tsx +45 -44
- package/components/Spinner/{spinner.scss → spinner.module.scss} +41 -41
- package/components/Switch/Switch.astro +13 -11
- package/components/Switch/Switch.svelte +26 -24
- package/components/Switch/Switch.tsx +14 -12
- package/components/Switch/{switch.scss → switch.module.scss} +4 -4
- package/components/Switch/switch.ts +8 -4
- package/components/Table/Table.astro +60 -60
- package/components/Table/Table.svelte +56 -54
- package/components/Table/Table.tsx +64 -63
- package/components/Table/{table.scss → table.module.scss} +64 -65
- package/components/Tabs/Tabs.astro +77 -76
- package/components/Tabs/Tabs.svelte +56 -54
- package/components/Tabs/Tabs.tsx +70 -69
- package/components/Tabs/{tabs.scss → tabs.module.scss} +30 -31
- package/components/ThemeSwitcher/ThemeSwitcher.astro +106 -0
- package/components/ThemeSwitcher/ThemeSwitcher.svelte +76 -0
- package/components/ThemeSwitcher/ThemeSwitcher.tsx +89 -0
- package/components/ThemeSwitcher/themeswitcher.module.scss +74 -0
- package/components/ThemeSwitcher/themeswitcher.ts +13 -0
- package/components/Timeline/Timeline.astro +36 -34
- package/components/Timeline/Timeline.svelte +32 -30
- package/components/Timeline/Timeline.tsx +38 -37
- package/components/Timeline/{timeline.scss → timeline.module.scss} +71 -71
- package/components/TimelineItem/TimelineItem.astro +27 -26
- package/components/TimelineItem/TimelineItem.svelte +24 -22
- package/components/TimelineItem/TimelineItem.tsx +33 -32
- package/components/TimelineItem/{timelineitem.scss → timelineitem.module.scss} +31 -31
- package/components/Toast/Toast.astro +41 -30
- package/components/Toast/Toast.svelte +32 -21
- package/components/Toast/Toast.tsx +38 -28
- package/components/Toast/{toast.scss → toast.module.scss} +44 -43
- package/components/Toast/toast.ts +3 -6
- package/icons/moon.svg +3 -0
- package/icons/sun.svg +3 -0
- package/index.js +3 -0
- package/package.json +3 -1
- package/react.d.ts +4 -0
- package/react.js +4 -0
- package/scss/global/elements.scss +1 -1
- package/scss/global/scrollbar.scss +21 -0
- package/scss/global/theme.scss +140 -0
- package/scss/global/tooltip.scss +8 -5
- package/scss/global/utility.scss +29 -0
- package/scss/global.scss +2 -0
- package/scss/resets.scss +5 -5
- package/scss/setup.scss +39 -18
- package/svelte.d.ts +16 -12
- package/svelte.js +4 -0
- package/utils/classNames.ts +4 -0
- package/utils/cookies.ts +28 -0
- package/utils/event.ts +17 -0
- package/utils/toast.ts +12 -9
- package/components/Alert/alert.scss +0 -53
- package/components/Badge/badge.scss +0 -85
- package/components/Button/button.scss +0 -91
- package/components/Card/card.scss +0 -37
|
@@ -1,83 +1,87 @@
|
|
|
1
|
-
@import '../../scss/config.scss';
|
|
2
|
-
|
|
3
|
-
.
|
|
4
|
-
border-radius: 2px;
|
|
5
|
-
padding: 5px 10px;
|
|
6
|
-
border: 1px solid
|
|
7
|
-
background: transparent;
|
|
8
|
-
font-family: Regular;
|
|
9
|
-
color:
|
|
10
|
-
line-height: 20px;
|
|
11
|
-
width: 100%;
|
|
12
|
-
color-scheme:
|
|
13
|
-
|
|
14
|
-
&[disabled] {
|
|
15
|
-
cursor: no-drop;
|
|
16
|
-
color:
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
&::file-selector-button {
|
|
20
|
-
background: transparent;
|
|
21
|
-
border: 0;
|
|
22
|
-
color:
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&.
|
|
34
|
-
border-color: #
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
&.
|
|
38
|
-
border-color: #
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&.
|
|
42
|
-
border-color: #
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&.
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
.input {
|
|
4
|
+
border-radius: 2px;
|
|
5
|
+
padding: 5px 10px;
|
|
6
|
+
border: 1px solid var(--w-color-primary-50);
|
|
7
|
+
background: transparent;
|
|
8
|
+
font-family: Regular;
|
|
9
|
+
color: var(--w-color-primary);
|
|
10
|
+
line-height: 20px;
|
|
11
|
+
width: 100%;
|
|
12
|
+
color-scheme: var(--w-color-scheme);
|
|
13
|
+
|
|
14
|
+
&[disabled] {
|
|
15
|
+
cursor: no-drop;
|
|
16
|
+
color: var(--w-color-primary-30);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&::file-selector-button {
|
|
20
|
+
background: transparent;
|
|
21
|
+
border: 0;
|
|
22
|
+
color: var(--w-color-primary);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&::placeholder {
|
|
26
|
+
color: var(--w-color-primary-30);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&[type="color"] {
|
|
30
|
+
padding: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&.info {
|
|
34
|
+
border-color: #48dbfb;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.success {
|
|
38
|
+
border-color: #1dd1a1;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.warning {
|
|
42
|
+
border-color: #f7aa61;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&.alert {
|
|
46
|
+
border-color: #ee5253;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&.fill {
|
|
50
|
+
background: var(--w-color-primary-50);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.input-label {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
|
|
58
|
+
.label {
|
|
59
|
+
font-size: 16px;
|
|
60
|
+
color: var(--w-color-primary-20);
|
|
61
|
+
margin-bottom: 5px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.wrapper {
|
|
65
|
+
display: flex;
|
|
66
|
+
gap: 10px;
|
|
67
|
+
align-items: center;
|
|
68
|
+
position: relative;
|
|
69
|
+
|
|
70
|
+
input {
|
|
71
|
+
padding-left: 40px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
svg {
|
|
75
|
+
position: absolute;
|
|
76
|
+
left: 10px;
|
|
77
|
+
width: 20px;
|
|
78
|
+
height: 20px;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.subtext {
|
|
83
|
+
font-size: 14px;
|
|
84
|
+
color: var(--w-color-primary-30);
|
|
85
|
+
margin-top: 5px;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -17,6 +17,7 @@ export type InputProps = {
|
|
|
17
17
|
| 'success'
|
|
18
18
|
| 'warning'
|
|
19
19
|
| 'alert'
|
|
20
|
+
| 'fill'
|
|
20
21
|
| null
|
|
21
22
|
value?: string | number
|
|
22
23
|
name?: string
|
|
@@ -24,7 +25,6 @@ export type InputProps = {
|
|
|
24
25
|
label?: string
|
|
25
26
|
disabled?: boolean
|
|
26
27
|
subText?: string
|
|
27
|
-
fill?: boolean
|
|
28
28
|
maxLength?: number
|
|
29
29
|
min?: number
|
|
30
30
|
max?: number
|
|
@@ -38,7 +38,13 @@ export type InputProps = {
|
|
|
38
38
|
[key: string]: any
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
export type SvelteInputProps = {
|
|
42
|
+
onChange?: (e: any) => any
|
|
43
|
+
onKeyUp?: (e: any) => any
|
|
44
|
+
} & InputProps
|
|
45
|
+
|
|
41
46
|
export type ReactInputProps = {
|
|
42
|
-
|
|
47
|
+
onChange?: (e: any) => any
|
|
48
|
+
onKeyUp?: (e: any) => any
|
|
43
49
|
children?: React.ReactNode
|
|
44
50
|
} & InputProps
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { MenuProps } from './menu'
|
|
3
|
+
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
|
|
4
|
+
|
|
5
|
+
import styles from './menu.module.scss'
|
|
6
|
+
|
|
7
|
+
interface Props extends MenuProps {}
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
items,
|
|
11
|
+
logo,
|
|
12
|
+
centerLogo,
|
|
13
|
+
className,
|
|
14
|
+
wrapperClassName
|
|
15
|
+
} = Astro.props
|
|
16
|
+
|
|
17
|
+
const classes = [
|
|
18
|
+
styles.menu,
|
|
19
|
+
className
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
const containerClasses = [
|
|
23
|
+
styles.container,
|
|
24
|
+
wrapperClassName
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
const wrapMenu = (logo?.url || logo?.html) && items?.length && Astro.slots.has('default')
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<header class:list={classes}>
|
|
31
|
+
<div class:list={containerClasses}>
|
|
32
|
+
<ConditionalWrapper condition={!!wrapMenu}>
|
|
33
|
+
<div slot="wrapper" class={styles.wrapper}>
|
|
34
|
+
children
|
|
35
|
+
</div>
|
|
36
|
+
{logo?.url && !centerLogo && (
|
|
37
|
+
<a href="/">
|
|
38
|
+
<img
|
|
39
|
+
src={logo.url}
|
|
40
|
+
alt={logo.alt || 'Logo'}
|
|
41
|
+
width={logo.width}
|
|
42
|
+
height={logo.height}
|
|
43
|
+
/>
|
|
44
|
+
</a>
|
|
45
|
+
)}
|
|
46
|
+
|
|
47
|
+
{!centerLogo && logo?.html && (
|
|
48
|
+
<a href="/">
|
|
49
|
+
<Fragment set:html={logo.html} />
|
|
50
|
+
</a>
|
|
51
|
+
)}
|
|
52
|
+
|
|
53
|
+
{items?.length && (
|
|
54
|
+
<ul>
|
|
55
|
+
{items.map(item => (
|
|
56
|
+
<li>
|
|
57
|
+
<a href={item.url} target={item.target}>
|
|
58
|
+
{item.name}
|
|
59
|
+
</a>
|
|
60
|
+
</li>
|
|
61
|
+
))}
|
|
62
|
+
</ul>
|
|
63
|
+
)}
|
|
64
|
+
</ConditionalWrapper>
|
|
65
|
+
|
|
66
|
+
{items?.length && (
|
|
67
|
+
<button class={styles.hamburger} data-id="hamburger">
|
|
68
|
+
<span class={styles.meat}></span>
|
|
69
|
+
<span class={styles.meat}></span>
|
|
70
|
+
<span class={styles.meat}></span>
|
|
71
|
+
<span class={styles.meat}></span>
|
|
72
|
+
</button>
|
|
73
|
+
)}
|
|
74
|
+
|
|
75
|
+
{centerLogo && logo?.html && (
|
|
76
|
+
<a href="/">
|
|
77
|
+
<Fragment set:html={logo.html} />
|
|
78
|
+
</a>
|
|
79
|
+
)}
|
|
80
|
+
|
|
81
|
+
{logo?.url && centerLogo && (
|
|
82
|
+
<a href="/">
|
|
83
|
+
<img
|
|
84
|
+
src={logo.url}
|
|
85
|
+
alt={logo.alt || 'Logo'}
|
|
86
|
+
width={logo.width}
|
|
87
|
+
height={logo.height}
|
|
88
|
+
/>
|
|
89
|
+
</a>
|
|
90
|
+
)}
|
|
91
|
+
|
|
92
|
+
<slot />
|
|
93
|
+
</div>
|
|
94
|
+
</header>
|
|
95
|
+
|
|
96
|
+
<script>
|
|
97
|
+
document
|
|
98
|
+
.querySelector('[data-id="hamburger"]')
|
|
99
|
+
?.addEventListener('click', event => {
|
|
100
|
+
const hamburger = event.currentTarget as HTMLDivElement
|
|
101
|
+
const header = hamburger.parentElement?.parentElement as HTMLHeadElement
|
|
102
|
+
|
|
103
|
+
header.dataset.active = header.dataset.active === 'true'
|
|
104
|
+
? 'false'
|
|
105
|
+
: 'true'
|
|
106
|
+
})
|
|
107
|
+
</script>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { MenuProps } from './menu'
|
|
3
|
+
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
4
|
+
|
|
5
|
+
import styles from './menu.module.scss'
|
|
6
|
+
import { classNames } from '../../utils/classNames'
|
|
7
|
+
|
|
8
|
+
export let items: MenuProps['items'] = []
|
|
9
|
+
export let logo: MenuProps['logo'] = null
|
|
10
|
+
export let centerLogo: MenuProps['centerLogo'] = false
|
|
11
|
+
export let className: MenuProps['className'] = ''
|
|
12
|
+
export let wrapperClassName: MenuProps['wrapperClassName'] = ''
|
|
13
|
+
|
|
14
|
+
const classes = classNames([
|
|
15
|
+
styles.menu,
|
|
16
|
+
className
|
|
17
|
+
])
|
|
18
|
+
|
|
19
|
+
const containerClasses = classNames([
|
|
20
|
+
styles.container,
|
|
21
|
+
wrapperClassName
|
|
22
|
+
])
|
|
23
|
+
|
|
24
|
+
const wrapMenu = (logo?.url || logo?.html) && items?.length && $$slots.default
|
|
25
|
+
|
|
26
|
+
let active = false
|
|
27
|
+
|
|
28
|
+
const toggleMenu = () => active = !active
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<header class={classes} data-active={active || null}>
|
|
32
|
+
<div class={containerClasses}>
|
|
33
|
+
<ConditionalWrapper condition={!!wrapMenu} class={styles.wrapper}>
|
|
34
|
+
{#if logo?.url && !centerLogo}
|
|
35
|
+
<a href="/">
|
|
36
|
+
<img
|
|
37
|
+
src={logo.url}
|
|
38
|
+
alt={logo.alt || 'Logo'}
|
|
39
|
+
width={logo.width}
|
|
40
|
+
height={logo.height}
|
|
41
|
+
/>
|
|
42
|
+
</a>
|
|
43
|
+
{/if}
|
|
44
|
+
|
|
45
|
+
{#if !centerLogo && logo?.html}
|
|
46
|
+
<a href="/">{@html logo.html}</a>
|
|
47
|
+
{/if}
|
|
48
|
+
|
|
49
|
+
{#if items?.length}
|
|
50
|
+
<ul>
|
|
51
|
+
{#each items as item}
|
|
52
|
+
<li>
|
|
53
|
+
<a href={item.url} target={item.target}>
|
|
54
|
+
{item.name}
|
|
55
|
+
</a>
|
|
56
|
+
</li>
|
|
57
|
+
{/each}
|
|
58
|
+
</ul>
|
|
59
|
+
{/if}
|
|
60
|
+
</ConditionalWrapper>
|
|
61
|
+
|
|
62
|
+
{#if items?.length}
|
|
63
|
+
<button class={styles.hamburger} on:click={toggleMenu}>
|
|
64
|
+
<span class={styles.meat}></span>
|
|
65
|
+
<span class={styles.meat}></span>
|
|
66
|
+
<span class={styles.meat}></span>
|
|
67
|
+
<span class={styles.meat}></span>
|
|
68
|
+
</button>
|
|
69
|
+
{/if}
|
|
70
|
+
|
|
71
|
+
{#if centerLogo && logo?.html}
|
|
72
|
+
<a href="/">{@html logo.html}</a>
|
|
73
|
+
{/if}
|
|
74
|
+
|
|
75
|
+
{#if logo?.url && centerLogo}
|
|
76
|
+
<a href="/">
|
|
77
|
+
<img
|
|
78
|
+
src={logo.url}
|
|
79
|
+
alt={logo.alt || 'Logo'}
|
|
80
|
+
width={logo.width}
|
|
81
|
+
height={logo.height}
|
|
82
|
+
/>
|
|
83
|
+
</a>
|
|
84
|
+
{/if}
|
|
85
|
+
|
|
86
|
+
<slot />
|
|
87
|
+
</div>
|
|
88
|
+
</header>
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import type { ReactMenuProps } from './menu'
|
|
3
|
+
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
|
|
4
|
+
|
|
5
|
+
import styles from './menu.module.scss'
|
|
6
|
+
import { classNames } from '../../utils/classNames'
|
|
7
|
+
|
|
8
|
+
const Menu = ({
|
|
9
|
+
items,
|
|
10
|
+
logo,
|
|
11
|
+
centerLogo,
|
|
12
|
+
className,
|
|
13
|
+
wrapperClassName,
|
|
14
|
+
children
|
|
15
|
+
}: ReactMenuProps) => {
|
|
16
|
+
const [active, setActive] = useState(false)
|
|
17
|
+
|
|
18
|
+
const classes = classNames([
|
|
19
|
+
styles.menu,
|
|
20
|
+
className
|
|
21
|
+
])
|
|
22
|
+
|
|
23
|
+
const containerClasses = classNames([
|
|
24
|
+
styles.container,
|
|
25
|
+
wrapperClassName
|
|
26
|
+
])
|
|
27
|
+
|
|
28
|
+
const wrapMenu = (logo?.url || logo?.html) && items?.length && children
|
|
29
|
+
|
|
30
|
+
const toggleMenu = () => setActive(!active)
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<header className={classes} data-active={active || null}>
|
|
34
|
+
<div className={containerClasses}>
|
|
35
|
+
<ConditionalWrapper
|
|
36
|
+
condition={!!wrapMenu}
|
|
37
|
+
wrapper={children => (
|
|
38
|
+
<div className={styles.wrapper}>
|
|
39
|
+
{children}
|
|
40
|
+
</div>
|
|
41
|
+
)}
|
|
42
|
+
>
|
|
43
|
+
{logo?.url && !centerLogo && (
|
|
44
|
+
<a href="/">
|
|
45
|
+
<img
|
|
46
|
+
src={logo.url}
|
|
47
|
+
alt={logo.alt || 'Logo'}
|
|
48
|
+
width={logo.width}
|
|
49
|
+
height={logo.height}
|
|
50
|
+
/>
|
|
51
|
+
</a>
|
|
52
|
+
)}
|
|
53
|
+
|
|
54
|
+
{!centerLogo && logo?.html && (
|
|
55
|
+
<a
|
|
56
|
+
href="/"
|
|
57
|
+
dangerouslySetInnerHTML={{ __html: logo.html }}
|
|
58
|
+
/>
|
|
59
|
+
)}
|
|
60
|
+
|
|
61
|
+
{!!items?.length && (
|
|
62
|
+
<ul>
|
|
63
|
+
{items.map((item, index) => (
|
|
64
|
+
<li key={index}>
|
|
65
|
+
<a href={item.url} target={item.target}>
|
|
66
|
+
{item.name}
|
|
67
|
+
</a>
|
|
68
|
+
</li>
|
|
69
|
+
))}
|
|
70
|
+
</ul>
|
|
71
|
+
)}
|
|
72
|
+
</ConditionalWrapper>
|
|
73
|
+
|
|
74
|
+
{!!items?.length && (
|
|
75
|
+
<button className={styles.hamburger} onClick={toggleMenu}>
|
|
76
|
+
<span className={styles.meat}></span>
|
|
77
|
+
<span className={styles.meat}></span>
|
|
78
|
+
<span className={styles.meat}></span>
|
|
79
|
+
<span className={styles.meat}></span>
|
|
80
|
+
</button>
|
|
81
|
+
)}
|
|
82
|
+
|
|
83
|
+
{centerLogo && logo?.html && (
|
|
84
|
+
<a
|
|
85
|
+
href="/"
|
|
86
|
+
dangerouslySetInnerHTML={{ __html: logo.html }}
|
|
87
|
+
/>
|
|
88
|
+
)}
|
|
89
|
+
|
|
90
|
+
{logo?.url && centerLogo && (
|
|
91
|
+
<a href="/">
|
|
92
|
+
<img
|
|
93
|
+
src={logo.url}
|
|
94
|
+
alt={logo.alt || 'Logo'}
|
|
95
|
+
width={logo.width}
|
|
96
|
+
height={logo.height}
|
|
97
|
+
/>
|
|
98
|
+
</a>
|
|
99
|
+
)}
|
|
100
|
+
|
|
101
|
+
{children}
|
|
102
|
+
</div>
|
|
103
|
+
</header>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export default Menu
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
.menu {
|
|
4
|
+
background: var(--w-color-primary-70);
|
|
5
|
+
padding: 15px;
|
|
6
|
+
font-size: 16px;
|
|
7
|
+
border-bottom: 1px solid var(--w-color-primary-50);
|
|
8
|
+
position: sticky;
|
|
9
|
+
top: 0;
|
|
10
|
+
z-index: 99;
|
|
11
|
+
|
|
12
|
+
&[data-active="true"] {
|
|
13
|
+
.hamburger {
|
|
14
|
+
box-shadow: 0 0 0 1000px var(--w-color-primary-70);
|
|
15
|
+
|
|
16
|
+
.meat:first-child,
|
|
17
|
+
.meat:last-child {
|
|
18
|
+
opacity: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.meat:first-child {
|
|
22
|
+
transform: translateY(20px) scale(0);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.meat:last-child {
|
|
26
|
+
transform: translateY(-20px) scale(0);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.meat:nth-child(2) {
|
|
30
|
+
transform: rotate(45deg);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.meat:nth-child(3) {
|
|
34
|
+
transform: rotate(-45deg);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
ul {
|
|
39
|
+
@include Transition(opacity);
|
|
40
|
+
opacity: 1;
|
|
41
|
+
z-index: 99;
|
|
42
|
+
pointer-events: all;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.wrapper {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
gap: 20px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
img,
|
|
53
|
+
svg {
|
|
54
|
+
display: block;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
ul {
|
|
58
|
+
margin: 0;
|
|
59
|
+
padding: 0;
|
|
60
|
+
list-style-type: none;
|
|
61
|
+
display: flex;
|
|
62
|
+
gap: 20px;
|
|
63
|
+
position: fixed;
|
|
64
|
+
top: 20px;
|
|
65
|
+
left: 20px;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
opacity: 0;
|
|
68
|
+
pointer-events: none;
|
|
69
|
+
|
|
70
|
+
a {
|
|
71
|
+
@include Transition(color);
|
|
72
|
+
color: var(--w-color-primary-20);
|
|
73
|
+
|
|
74
|
+
&:hover {
|
|
75
|
+
color: var(--w-color-primary);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.hamburger {
|
|
81
|
+
@include Transition(box-shadow);
|
|
82
|
+
position: relative;
|
|
83
|
+
width: 30px;
|
|
84
|
+
height: 20px;
|
|
85
|
+
box-shadow: 0 0 0 0 var(--w-color-primary-70);
|
|
86
|
+
border-radius: 50%;
|
|
87
|
+
padding: 0;
|
|
88
|
+
border: 0;
|
|
89
|
+
background: transparent;
|
|
90
|
+
z-index: 98;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
|
|
93
|
+
.meat {
|
|
94
|
+
@include Transition();
|
|
95
|
+
width: 100%;
|
|
96
|
+
position: absolute;
|
|
97
|
+
height: 2px;
|
|
98
|
+
background: var(--w-color-primary);
|
|
99
|
+
display: block;
|
|
100
|
+
border-radius: 5px;
|
|
101
|
+
|
|
102
|
+
&:first-child {
|
|
103
|
+
top: 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&:nth-child(2),
|
|
107
|
+
&:nth-child(3) {
|
|
108
|
+
top: 50%;
|
|
109
|
+
transform: translateY(-50%);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&:last-child {
|
|
113
|
+
bottom: 0;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.container {
|
|
120
|
+
display: flex;
|
|
121
|
+
align-items: center;
|
|
122
|
+
gap: 20px;
|
|
123
|
+
justify-content: space-between;
|
|
124
|
+
flex-wrap: wrap;
|
|
125
|
+
max-width: 1200px;
|
|
126
|
+
margin: 0 auto;
|
|
127
|
+
padding: 0 20px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@include Media('sm') {
|
|
131
|
+
.menu {
|
|
132
|
+
.hamburger {
|
|
133
|
+
display: none;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
ul {
|
|
137
|
+
position: static;
|
|
138
|
+
opacity: 1;
|
|
139
|
+
flex-direction: row;
|
|
140
|
+
pointer-events: all;
|
|
141
|
+
transform: none;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type MenuProps = {
|
|
2
|
+
items?: {
|
|
3
|
+
url: string
|
|
4
|
+
name: string
|
|
5
|
+
target?: string
|
|
6
|
+
}[]
|
|
7
|
+
logo?: {
|
|
8
|
+
url?: string
|
|
9
|
+
alt?: string
|
|
10
|
+
width?: number
|
|
11
|
+
height?: number
|
|
12
|
+
html?: string
|
|
13
|
+
} | null
|
|
14
|
+
centerLogo?: boolean
|
|
15
|
+
className?: string
|
|
16
|
+
wrapperClassName?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type ReactMenuProps = {
|
|
20
|
+
children?: React.ReactNode
|
|
21
|
+
} & MenuProps
|