oddsgate-ds 1.0.23 → 1.0.25
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/dist/cjs/index.js +5 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/Dropdown/Dropdown.theme.ts +29 -10
- package/src/components/organisms/CircularSlider/CircularSlider.component.tsx +36 -17
- package/src/components/organisms/CircularSlider/CircularSlider.stories.tsx +7 -11
- package/src/components/organisms/CircularSlider/CircularSlider.theme.ts +19 -11
- package/src/components/organisms/Cover/Cover.component.tsx +2 -2
- package/src/components/organisms/Tabs/Tabs.theme.ts +7 -1
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { IDropdown, IDropdownContainer, IDropdownItem, IDropdownTitle } from './Dropdown.interface';
|
|
2
|
-
import { colors, responsiveMedia, shadows } from '@/styles/variables';
|
|
2
|
+
import { colors, radius, responsiveMedia, shadows } from '@/styles/variables';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
4
|
|
|
5
|
+
import { fontSize } from '@/styles/utilities';
|
|
6
|
+
|
|
5
7
|
export const StyledDropdown = styled.div<IDropdown>`
|
|
6
8
|
position: relative;
|
|
7
9
|
display: inline-flex;
|
|
@@ -10,12 +12,26 @@ export const StyledDropdown = styled.div<IDropdown>`
|
|
|
10
12
|
export const StyledDropdownTitle = styled.div<IDropdownTitle>`
|
|
11
13
|
display: flex;
|
|
12
14
|
align-items: center;
|
|
15
|
+
|
|
16
|
+
color: ${colors.primary50};
|
|
17
|
+
background-color: ${colors.secondary50};
|
|
18
|
+
|
|
19
|
+
${fontSize('h5')};
|
|
20
|
+
padding: 10px 20px;
|
|
21
|
+
border-radius: 50px;
|
|
22
|
+
text-transform:uppercase;
|
|
23
|
+
|
|
13
24
|
transition: color 0.15s ease-in-out;
|
|
14
25
|
cursor: pointer;
|
|
15
26
|
|
|
27
|
+
&:hover{
|
|
28
|
+
color: ${colors.secondary50};
|
|
29
|
+
background-color: ${colors.primary50};
|
|
30
|
+
}
|
|
31
|
+
|
|
16
32
|
${({ open }) => open && `
|
|
17
|
-
color: ${colors.
|
|
18
|
-
|
|
33
|
+
color: ${colors.secondary50};
|
|
34
|
+
background-color: ${colors.primary50};
|
|
19
35
|
`}
|
|
20
36
|
`;
|
|
21
37
|
|
|
@@ -26,25 +42,28 @@ export const StyledDropdownContainer = styled.ul<IDropdownContainer>`
|
|
|
26
42
|
left: 0;
|
|
27
43
|
|
|
28
44
|
margin-top: 12px;
|
|
29
|
-
padding
|
|
30
|
-
background: ${colors.
|
|
45
|
+
padding: 20px;
|
|
46
|
+
background: ${colors.secondary50};
|
|
31
47
|
box-shadow: ${shadows.sm};
|
|
48
|
+
border-radius: ${radius.md};
|
|
49
|
+
|
|
50
|
+
min-width: 18rem;
|
|
32
51
|
|
|
33
52
|
opacity: ${props => props.open ? 1 : 0};
|
|
34
53
|
pointer-events: ${props => props.open ? "auto" : "none"};
|
|
35
54
|
|
|
55
|
+
transform: ${props => props.open ? "rotate(0deg) translateY(0)" : "rotate(8deg) translateY(30px)"}; ;
|
|
56
|
+
|
|
36
57
|
z-index: 1;
|
|
37
|
-
transition:
|
|
58
|
+
transition: all 0.35s ease-in-out;
|
|
38
59
|
`;
|
|
39
60
|
export const StyledDropdownItem = styled.li<IDropdownItem>`
|
|
40
61
|
display:flex;
|
|
41
|
-
|
|
62
|
+
gap: 8px;
|
|
42
63
|
align-items: center;
|
|
43
|
-
width: 100%;
|
|
44
|
-
padding: 8px 18px;
|
|
45
64
|
cursor: pointer;
|
|
46
65
|
|
|
47
66
|
&:hover {
|
|
48
|
-
color: ${colors.
|
|
67
|
+
color: ${colors.primary50}
|
|
49
68
|
}
|
|
50
69
|
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react'
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react'
|
|
2
2
|
import {
|
|
3
3
|
StyledCircularSlider,
|
|
4
4
|
StyledCircularSliderContent,
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
StyledCircularSliderWrapper
|
|
8
8
|
} from './CircularSlider.theme'
|
|
9
9
|
|
|
10
|
+
import Heading from '@/components/atoms/Heading/Heading.component';
|
|
10
11
|
import { ICircularSlider } from './CircularSlider.interface'
|
|
11
12
|
|
|
12
13
|
const CircularSlider = ({
|
|
@@ -15,14 +16,28 @@ const CircularSlider = ({
|
|
|
15
16
|
className,
|
|
16
17
|
}: ICircularSlider) => {
|
|
17
18
|
|
|
19
|
+
const [slideContent, setSlideContent] = useState({
|
|
20
|
+
name: '',
|
|
21
|
+
role: '',
|
|
22
|
+
});
|
|
18
23
|
const slider = useRef<HTMLDivElement>();
|
|
19
24
|
const wrapper = useRef<HTMLDivElement>();
|
|
20
25
|
const slidesHolder = useRef<HTMLDivElement>();
|
|
26
|
+
const contentHolder = useRef<HTMLDivElement>();
|
|
21
27
|
|
|
22
|
-
const sliderSize =
|
|
23
|
-
const slideSize = 15
|
|
28
|
+
const sliderSize = 1;
|
|
29
|
+
const slideSize = 0.15;
|
|
24
30
|
|
|
25
31
|
|
|
32
|
+
//force 12 items
|
|
33
|
+
if (content && content.length < 12) {
|
|
34
|
+
let counter = 0;
|
|
35
|
+
for (let i = content.length; i <= 12; i++) {
|
|
36
|
+
content[i] = content[counter];
|
|
37
|
+
counter++;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
26
41
|
useEffect(() => {
|
|
27
42
|
if (!slidesHolder.current) return //bail out;
|
|
28
43
|
|
|
@@ -34,8 +49,8 @@ const CircularSlider = ({
|
|
|
34
49
|
|
|
35
50
|
let currentAngle = -90;
|
|
36
51
|
|
|
37
|
-
|
|
38
|
-
const stepAngle = 0.52;
|
|
52
|
+
const stepAngle = 2 * Math.PI / slidesHolder?.current?.children.length;
|
|
53
|
+
// const stepAngle = 0.52;
|
|
39
54
|
|
|
40
55
|
let currentSlide = 0;
|
|
41
56
|
|
|
@@ -81,10 +96,18 @@ const CircularSlider = ({
|
|
|
81
96
|
}
|
|
82
97
|
|
|
83
98
|
const addStyle = () => {
|
|
99
|
+
setTimeout(() => {
|
|
100
|
+
contentHolder?.current?.classList.add('active');
|
|
101
|
+
}, 400);
|
|
102
|
+
|
|
103
|
+
content && setSlideContent(content[currentSlide] as any)
|
|
84
104
|
slides[currentSlide].classList.add('slides-holder__item_active');
|
|
85
105
|
slides[currentSlide].style.height = slides[currentSlide].style.width = slidesSize + 20 + 'px';
|
|
86
106
|
};
|
|
87
107
|
const removeStyle = () => {
|
|
108
|
+
contentHolder?.current?.classList.remove('active');
|
|
109
|
+
|
|
110
|
+
content && setSlideContent(content[currentSlide] as any)
|
|
88
111
|
slides[currentSlide].classList.remove('slides-holder__item_active');
|
|
89
112
|
slides[currentSlide].style.height = slides[currentSlide].style.width = slidesSize + 'px';
|
|
90
113
|
};
|
|
@@ -131,18 +154,17 @@ const CircularSlider = ({
|
|
|
131
154
|
}
|
|
132
155
|
}, [])
|
|
133
156
|
|
|
157
|
+
if (!content) return <></>
|
|
134
158
|
|
|
135
159
|
return (
|
|
136
|
-
<StyledCircularSlider ref={slider as any}>
|
|
160
|
+
<StyledCircularSlider ref={slider as any} className={className} style={style}>
|
|
161
|
+
<StyledCircularSliderContent ref={contentHolder as any}>
|
|
162
|
+
<div>
|
|
163
|
+
<Heading tag="span" size="h2" className='color-primary50 fw-bold'>{slideContent?.name}</Heading>
|
|
164
|
+
<Heading tag="span" size="h4" className='color-secondary50'>{slideContent?.role}</Heading>
|
|
165
|
+
</div>
|
|
166
|
+
</StyledCircularSliderContent>
|
|
137
167
|
<StyledCircularSliderWrapper ref={wrapper as any}>
|
|
138
|
-
{/* <div className="controls">
|
|
139
|
-
<div className="controls__left">
|
|
140
|
-
<div className="icon-wrapper">left</div>
|
|
141
|
-
</div>
|
|
142
|
-
<div className="controls__right">
|
|
143
|
-
<div className="icon-wrapper">right</div>
|
|
144
|
-
</div>
|
|
145
|
-
</div> */}
|
|
146
168
|
<StyledCircularSliderSlides ref={slidesHolder as any}>
|
|
147
169
|
{content?.map((item, index) => {
|
|
148
170
|
return (
|
|
@@ -150,9 +172,6 @@ const CircularSlider = ({
|
|
|
150
172
|
)
|
|
151
173
|
})}
|
|
152
174
|
</StyledCircularSliderSlides>
|
|
153
|
-
<StyledCircularSliderContent>
|
|
154
|
-
|
|
155
|
-
</StyledCircularSliderContent>
|
|
156
175
|
</StyledCircularSliderWrapper>
|
|
157
176
|
</StyledCircularSlider>
|
|
158
177
|
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
2
|
|
|
3
|
-
import Button from '../../atoms/Button/Button.component'
|
|
4
3
|
import CircularSlider from './CircularSlider.component'
|
|
5
|
-
import Flex from '../../atoms/Flex/Flex.component'
|
|
6
4
|
import { ICircularSlider } from './CircularSlider.interface'
|
|
7
5
|
import React from 'react'
|
|
8
|
-
import RichText from '../../atoms/RichText/RichText.component'
|
|
9
|
-
import Video from '../../atoms/Video/Video.component'
|
|
10
6
|
|
|
11
7
|
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
12
8
|
export default {
|
|
@@ -35,37 +31,37 @@ export const Simple: StoryObj<ICircularSlider> = {
|
|
|
35
31
|
args: {
|
|
36
32
|
content: [
|
|
37
33
|
{
|
|
38
|
-
name: "My name",
|
|
34
|
+
name: "My name 1",
|
|
39
35
|
role: "My role",
|
|
40
36
|
img: image
|
|
41
37
|
},
|
|
42
38
|
{
|
|
43
|
-
name: "My name",
|
|
39
|
+
name: "My name 2",
|
|
44
40
|
role: "My role",
|
|
45
41
|
img: image
|
|
46
42
|
},
|
|
47
43
|
{
|
|
48
|
-
name: "My name",
|
|
44
|
+
name: "My name 3",
|
|
49
45
|
role: "My role",
|
|
50
46
|
img: image
|
|
51
47
|
},
|
|
52
48
|
{
|
|
53
|
-
name: "My name",
|
|
49
|
+
name: "My name 4",
|
|
54
50
|
role: "My role",
|
|
55
51
|
img: image
|
|
56
52
|
},
|
|
57
53
|
{
|
|
58
|
-
name: "My name",
|
|
54
|
+
name: "My name 5",
|
|
59
55
|
role: "My role",
|
|
60
56
|
img: image
|
|
61
57
|
},
|
|
62
58
|
{
|
|
63
|
-
name: "My name",
|
|
59
|
+
name: "My name 6",
|
|
64
60
|
role: "My role",
|
|
65
61
|
img: image
|
|
66
62
|
},
|
|
67
63
|
{
|
|
68
|
-
name: "My name",
|
|
64
|
+
name: "My name 7",
|
|
69
65
|
role: "My role",
|
|
70
66
|
img: image
|
|
71
67
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ICircularSlider } from './CircularSlider.interface';
|
|
2
|
-
import { StyledVideo } from '../../atoms/Video/Video.theme';
|
|
3
2
|
import styled from 'styled-components';
|
|
4
3
|
|
|
5
4
|
export const StyledCircularSlider = styled.div<ICircularSlider>`
|
|
@@ -13,19 +12,16 @@ export const StyledCircularSlider = styled.div<ICircularSlider>`
|
|
|
13
12
|
`;
|
|
14
13
|
|
|
15
14
|
export const StyledCircularSliderWrapper = styled.div<ICircularSlider>`
|
|
16
|
-
|
|
17
|
-
margin-right: 0;
|
|
15
|
+
position: relative;
|
|
18
16
|
display: flex;
|
|
19
17
|
justify-content: center;
|
|
20
|
-
|
|
18
|
+
margin: 0 auto;
|
|
19
|
+
margin-right: 0;
|
|
21
20
|
padding: 20px 20px 0px 20px;
|
|
22
|
-
|
|
23
|
-
transform: translateX(60%);
|
|
21
|
+
transform: translateX(65%);
|
|
24
22
|
`;
|
|
25
23
|
|
|
26
24
|
export const StyledCircularSliderSlides = styled.div<ICircularSlider>`
|
|
27
|
-
border-radius: 50%;
|
|
28
|
-
border: 2px solid #8EB8E5;
|
|
29
25
|
transform-origin: center;
|
|
30
26
|
display: flex;
|
|
31
27
|
justify-content: center;
|
|
@@ -35,11 +31,8 @@ export const StyledCircularSliderSlides = styled.div<ICircularSlider>`
|
|
|
35
31
|
transform: rotate(-90deg);
|
|
36
32
|
`;
|
|
37
33
|
export const StyledCircularSliderSlide = styled.div<ICircularSlider>`
|
|
38
|
-
border-radius: 50%;
|
|
39
|
-
border: 2px solid #7C99B4;
|
|
40
34
|
position: absolute;
|
|
41
35
|
transform-origin: center;
|
|
42
|
-
background-color: #222;
|
|
43
36
|
transition: .3s linear all;
|
|
44
37
|
filter: brightness(70%);
|
|
45
38
|
|
|
@@ -53,6 +46,21 @@ export const StyledCircularSliderSlide = styled.div<ICircularSlider>`
|
|
|
53
46
|
`;
|
|
54
47
|
|
|
55
48
|
export const StyledCircularSliderContent = styled.div<ICircularSlider>`
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: 50%;
|
|
51
|
+
left:33.333%;
|
|
52
|
+
|
|
53
|
+
width: 25%;
|
|
54
|
+
text-align: center;
|
|
56
55
|
|
|
56
|
+
opacity: 0;
|
|
57
|
+
transform: translateY(10%);
|
|
58
|
+
transition: all 0.3s ease;
|
|
59
|
+
|
|
60
|
+
&.active{
|
|
61
|
+
opacity: 1;
|
|
62
|
+
transform: translateY(-50%);
|
|
63
|
+
|
|
64
|
+
}
|
|
57
65
|
`;
|
|
58
66
|
|
|
@@ -33,11 +33,11 @@ const Cover = ({
|
|
|
33
33
|
style={{ ...style, minHeight: minHeight || undefined }}
|
|
34
34
|
>
|
|
35
35
|
{imageElement}
|
|
36
|
-
{overlayColor && overlayOpacity
|
|
36
|
+
{overlayColor && overlayOpacity ? (
|
|
37
37
|
<StyledCoverOverlay
|
|
38
38
|
style={{ backgroundColor: overlayColor, opacity: overlayOpacity }}
|
|
39
39
|
></StyledCoverOverlay>
|
|
40
|
-
)}
|
|
40
|
+
) : (<></>)}
|
|
41
41
|
<StyledCoverContent>{children}</StyledCoverContent>
|
|
42
42
|
</StyledCover>
|
|
43
43
|
)
|
|
@@ -22,7 +22,7 @@ export const StyledTabsLinks = styled.a<ITabsItem>`
|
|
|
22
22
|
align-items: center;
|
|
23
23
|
justify-content: space-between;
|
|
24
24
|
width: 100%;
|
|
25
|
-
color: ${colors.
|
|
25
|
+
color: ${colors.secondary50};
|
|
26
26
|
background-color: ${colors.third10};
|
|
27
27
|
padding: 8px 18px;
|
|
28
28
|
border-radius: 50px;
|
|
@@ -32,6 +32,10 @@ export const StyledTabsLinks = styled.a<ITabsItem>`
|
|
|
32
32
|
&:hover{
|
|
33
33
|
background-color: ${colors.primary50};
|
|
34
34
|
}
|
|
35
|
+
|
|
36
|
+
${({ $active }) => $active && `
|
|
37
|
+
background-color: ${colors.primary50};
|
|
38
|
+
`}
|
|
35
39
|
`
|
|
36
40
|
|
|
37
41
|
|
|
@@ -66,6 +70,8 @@ export const StyledTabs = styled.div<ITabs>`
|
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
${StyledTabsMenu}{
|
|
73
|
+
flex-flow: column;
|
|
74
|
+
align-items: stretch;
|
|
69
75
|
justify-content: flex-start;
|
|
70
76
|
}
|
|
71
77
|
}
|