oddsgate-ds 1.0.64 → 1.0.65
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/cjs/types/helpers/isTouchDevice.d.ts +2 -0
- package/dist/cjs/types/styles/variables.d.ts +3 -3
- package/dist/esm/index.js +5 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/helpers/isTouchDevice.d.ts +2 -0
- package/dist/esm/types/styles/variables.d.ts +3 -3
- package/dist/types.d.ts +3 -3
- package/package.json +1 -1
- package/src/components/organisms/Slider/Slider.component.tsx +9 -1
- package/src/components/organisms/Slider/Slider.stories.tsx +9 -7
- package/src/components/organisms/Slider/Slider.theme.ts +39 -21
- package/src/helpers/isTouchDevice.tsx +11 -0
- package/src/styles/utilities.ts +8 -9
- package/src/styles/variables.ts +17 -17
|
@@ -2,9 +2,9 @@ export declare const pxToRem: (size: number) => string;
|
|
|
2
2
|
export declare const fontName = "MD Nichrome";
|
|
3
3
|
export declare const alternativeFont = "Red Hat Display";
|
|
4
4
|
export declare const gutter: string;
|
|
5
|
-
export declare const desktop_width
|
|
6
|
-
export declare const tablet_width
|
|
7
|
-
export declare const mobile_width
|
|
5
|
+
export declare const desktop_width: number;
|
|
6
|
+
export declare const tablet_width: number;
|
|
7
|
+
export declare const mobile_width: number;
|
|
8
8
|
export declare const responsiveMedia = "980px";
|
|
9
9
|
export declare const mobileMedia = "360px";
|
|
10
10
|
export declare const easeOutExpo = "cubic-bezier(.32,.94,.6,1);";
|
package/dist/types.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ declare const pxToRem: (size: number) => string;
|
|
|
7
7
|
declare const fontName = "MD Nichrome";
|
|
8
8
|
declare const alternativeFont = "Red Hat Display";
|
|
9
9
|
declare const gutter: string;
|
|
10
|
-
declare const desktop_width
|
|
11
|
-
declare const tablet_width
|
|
12
|
-
declare const mobile_width
|
|
10
|
+
declare const desktop_width: number;
|
|
11
|
+
declare const tablet_width: number;
|
|
12
|
+
declare const mobile_width: number;
|
|
13
13
|
declare const responsiveMedia = "980px";
|
|
14
14
|
declare const mobileMedia = "360px";
|
|
15
15
|
declare const easeOutExpo = "cubic-bezier(.32,.94,.6,1);";
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import Button from '@/components/atoms/Button/Button.component'
|
|
|
4
4
|
import { ISlider } from './Slider.interface'
|
|
5
5
|
import Icon from '@/components/atoms/Icon/Icon.component'
|
|
6
6
|
import { StyledSlider } from './Slider.theme'
|
|
7
|
+
import isTouchDevice from '@/helpers/isTouchDevice'
|
|
7
8
|
import { useBlazeSlider } from './Slider.utils'
|
|
8
9
|
|
|
9
10
|
const Slider = ({
|
|
@@ -27,6 +28,8 @@ const Slider = ({
|
|
|
27
28
|
let elRef: any = null
|
|
28
29
|
let sliderRef: any = null
|
|
29
30
|
|
|
31
|
+
const isMobile = isTouchDevice();
|
|
32
|
+
|
|
30
33
|
const setConfig = () => {
|
|
31
34
|
if (sliderRef?.current) sliderRef.current.destroy()
|
|
32
35
|
responsiveCSS = `
|
|
@@ -102,7 +105,12 @@ const Slider = ({
|
|
|
102
105
|
// mediaQueries
|
|
103
106
|
// ])
|
|
104
107
|
|
|
105
|
-
|
|
108
|
+
if (mobileOnly) {
|
|
109
|
+
isMobile && setConfig();
|
|
110
|
+
} else {
|
|
111
|
+
setConfig();
|
|
112
|
+
}
|
|
113
|
+
|
|
106
114
|
|
|
107
115
|
return (
|
|
108
116
|
<StyledSlider
|
|
@@ -86,9 +86,11 @@ export const MobileOnly: StoryObj<ISlider> = {
|
|
|
86
86
|
slidesToScroll={1}
|
|
87
87
|
infinite={false}
|
|
88
88
|
spacing={'1rem'}
|
|
89
|
+
autoplay={false}
|
|
89
90
|
mediaQueries={{
|
|
90
91
|
900: {
|
|
91
|
-
slidesToShow: 2
|
|
92
|
+
slidesToShow: 2,
|
|
93
|
+
autoplay: true,
|
|
92
94
|
},
|
|
93
95
|
500: {
|
|
94
96
|
slidesToShow: 1
|
|
@@ -96,12 +98,12 @@ export const MobileOnly: StoryObj<ISlider> = {
|
|
|
96
98
|
}}
|
|
97
99
|
{...args}
|
|
98
100
|
>
|
|
99
|
-
<div>{image}</div>
|
|
100
|
-
<div>{image}</div>
|
|
101
|
-
<div>{image}</div>
|
|
102
|
-
<div>{image}</div>
|
|
103
|
-
<div>{image}</div>
|
|
104
|
-
<div>{image}</div>
|
|
101
|
+
<div style={{ maxWidth: "100%" }}>{image}</div>
|
|
102
|
+
<div style={{ maxWidth: "25%" }}>{image}</div>
|
|
103
|
+
<div style={{ maxWidth: "25%" }}>{image}</div>
|
|
104
|
+
<div style={{ maxWidth: "25%" }}>{image}</div>
|
|
105
|
+
<div style={{ maxWidth: "25%" }}>{image}</div>
|
|
106
|
+
<div style={{ maxWidth: "25%" }}>{image}</div>
|
|
105
107
|
</Slider>
|
|
106
108
|
</div>
|
|
107
109
|
),
|
|
@@ -3,10 +3,7 @@ import styled, { css } from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
import { ISlider } from './Slider.interface';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
position:relative;
|
|
8
|
-
width: 100%;
|
|
9
|
-
|
|
6
|
+
const SliderStyles = `
|
|
10
7
|
//vendor styles
|
|
11
8
|
.blaze-slider {
|
|
12
9
|
/* default config */
|
|
@@ -36,16 +33,9 @@ export const StyledSlider = styled.div<ISlider>`
|
|
|
36
33
|
);
|
|
37
34
|
}
|
|
38
35
|
|
|
39
|
-
.blaze-track,
|
|
40
36
|
.blaze-track > div {
|
|
41
|
-
box-sizing: border-box;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.blaze-track > div {
|
|
45
|
-
position: relative;
|
|
46
37
|
width: var(--slide-width);
|
|
47
|
-
|
|
48
|
-
max-width: unset;
|
|
38
|
+
max-width: unset !important;
|
|
49
39
|
flex-shrink: 0;
|
|
50
40
|
}
|
|
51
41
|
|
|
@@ -122,17 +112,45 @@ export const StyledSlider = styled.div<ISlider>`
|
|
|
122
112
|
`}
|
|
123
113
|
|
|
124
114
|
${({ $mobileOnly }) => $mobileOnly && `
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
115
|
+
@media only screen and (min-width: ${responsiveMedia}) {
|
|
116
|
+
.blaze-track{
|
|
117
|
+
flex-flow: row wrap;
|
|
118
|
+
width: 100% !important;
|
|
119
|
+
max-width: 100% !important;
|
|
120
|
+
transform: none !important;
|
|
121
|
+
gap: 0 !important;
|
|
122
|
+
|
|
123
|
+
&>div{
|
|
124
|
+
width: 100% !important;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
131
127
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
128
|
+
.blaze-arrows,
|
|
129
|
+
.blaze-controls{
|
|
130
|
+
display:none;
|
|
131
|
+
}
|
|
135
132
|
}
|
|
136
133
|
`}
|
|
137
134
|
}
|
|
138
135
|
`;
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
export const StyledSlider = styled.div<ISlider>`
|
|
139
|
+
position:relative;
|
|
140
|
+
width: 100%;
|
|
141
|
+
|
|
142
|
+
${({ $mobileOnly }) => $mobileOnly ? (`
|
|
143
|
+
@media only screen and (max-width: ${responsiveMedia}) {
|
|
144
|
+
${SliderStyles}
|
|
145
|
+
}
|
|
146
|
+
@media only screen and (min-width: ${responsiveMedia}) {
|
|
147
|
+
.blaze-controls{
|
|
148
|
+
display:none;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
`)
|
|
152
|
+
: (`
|
|
153
|
+
${SliderStyles}
|
|
154
|
+
`)}
|
|
155
|
+
|
|
156
|
+
`;
|
package/src/styles/utilities.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
colors,
|
|
3
|
+
desktop_width,
|
|
3
4
|
gradients,
|
|
4
5
|
grid_conf,
|
|
5
6
|
radius,
|
|
@@ -12,17 +13,15 @@ import {
|
|
|
12
13
|
} from './variables';
|
|
13
14
|
|
|
14
15
|
export const fontSize = (typo: string) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
font-size: ${typography[typo].sizeMob};
|
|
16
|
+
const size = parseInt(typography[typo].size as string);
|
|
17
|
+
const percentage = 0.2;
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
` : `
|
|
23
|
-
font-size: ${typography[typo].size};
|
|
24
|
-
`}
|
|
19
|
+
const min = typography[typo].sizeMob ?? typography[typo].size; // check if size mobile exists
|
|
20
|
+
const max = ((size / desktop_width) * 100).toFixed(3); // get vw value divise font size for desktop width
|
|
21
|
+
const range = Math.ceil(size + (size * percentage)); // use desktop font-size and add a range of percentage
|
|
25
22
|
|
|
23
|
+
return `
|
|
24
|
+
font-size: clamp(${min}, ${max}vw, ${range}px);
|
|
26
25
|
line-height: ${typography[typo].height};
|
|
27
26
|
`
|
|
28
27
|
}
|
package/src/styles/variables.ts
CHANGED
|
@@ -7,9 +7,9 @@ export const alternativeFont = "Red Hat Display";
|
|
|
7
7
|
|
|
8
8
|
export const gutter = pxToRem(8); //needs to be in this file
|
|
9
9
|
|
|
10
|
-
export const desktop_width =
|
|
11
|
-
export const tablet_width =
|
|
12
|
-
export const mobile_width =
|
|
10
|
+
export const desktop_width:number = 1620; //container size of design on desktop
|
|
11
|
+
export const tablet_width:number = 768; //container size of design on tablet
|
|
12
|
+
export const mobile_width:number = 375; //container size of design on mobile
|
|
13
13
|
export const responsiveMedia = "980px"; //mobile media value for bootstrap
|
|
14
14
|
export const mobileMedia = "360px"; //mobile media value
|
|
15
15
|
|
|
@@ -89,38 +89,38 @@ export const spacesNegative = <Record<string, string>>{
|
|
|
89
89
|
//if responsive is not needed for a size just set the size as px instead of rem
|
|
90
90
|
export const typography = <Record<string, Record<string, unknown>>>{
|
|
91
91
|
display: {
|
|
92
|
-
size:
|
|
93
|
-
sizeMob:
|
|
92
|
+
size: "250px",
|
|
93
|
+
sizeMob: "64px",
|
|
94
94
|
height: 1.2,
|
|
95
95
|
},
|
|
96
96
|
h1: {
|
|
97
|
-
size:
|
|
98
|
-
sizeMob:
|
|
97
|
+
size: "120px",
|
|
98
|
+
sizeMob: "48px",
|
|
99
99
|
height: 1.2,
|
|
100
100
|
},
|
|
101
101
|
h2: {
|
|
102
|
-
size:
|
|
103
|
-
sizeMob:
|
|
102
|
+
size: "80px",
|
|
103
|
+
sizeMob: "36px",
|
|
104
104
|
height: 1.2,
|
|
105
105
|
},
|
|
106
106
|
h3: {
|
|
107
|
-
size:
|
|
108
|
-
sizeMob:
|
|
107
|
+
size: "48px",
|
|
108
|
+
sizeMob: "24px",
|
|
109
109
|
height: 1.2,
|
|
110
110
|
},
|
|
111
111
|
h4: {
|
|
112
|
-
size:
|
|
113
|
-
sizeMob:
|
|
112
|
+
size: "36px",
|
|
113
|
+
sizeMob: "20px",
|
|
114
114
|
height: 1.2,
|
|
115
115
|
},
|
|
116
116
|
h5: {
|
|
117
|
-
size:
|
|
118
|
-
sizeMob:
|
|
117
|
+
size: "24px",
|
|
118
|
+
sizeMob: "18px",
|
|
119
119
|
height: 1.4,
|
|
120
120
|
},
|
|
121
121
|
h6: {
|
|
122
|
-
size:
|
|
123
|
-
sizeMob:
|
|
122
|
+
size: "18px",
|
|
123
|
+
sizeMob: "16px",
|
|
124
124
|
height: 1.4,
|
|
125
125
|
},
|
|
126
126
|
texts: {
|