oddsgate-ds 1.0.157 → 1.0.159

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.
@@ -1,4 +1,4 @@
1
1
  import { ISpacer } from './Spacer.interface';
2
2
  import React from 'react';
3
- declare const Spacer: ({ id, color, customHeight, height, className, ...props }: ISpacer) => React.JSX.Element;
3
+ declare const Spacer: ({ id, color, customHeight, customHeightTablet, customHeightMobile, height, className, gradient }: ISpacer) => React.JSX.Element;
4
4
  export default Spacer;
@@ -2,9 +2,19 @@ import { CSSProperties } from 'react';
2
2
  import { spaces } from '@/styles/variables';
3
3
  export type ISpacer = {
4
4
  id?: string;
5
+ anchor?: string;
5
6
  color?: string;
6
7
  height?: keyof typeof spaces | string | number;
7
8
  customHeight?: string;
9
+ customHeightTablet?: string;
10
+ customHeightMobile?: string;
8
11
  className?: string;
9
12
  style?: CSSProperties;
13
+ gradient?: string;
14
+ };
15
+ export type ISCSpacer = {
16
+ $color: ISpacer['color'];
17
+ $height: ISpacer['height'];
18
+ $customHeightTablet: ISpacer['customHeightTablet'];
19
+ $customHeightMobile: ISpacer['customHeightMobile'];
10
20
  };
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { ISpacer } from './Spacer.interface';
3
- export declare const StyledSpacer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ISpacer>> & string;
2
+ import { ISCSpacer } from "./Spacer.interface";
3
+ export declare const StyledSpacer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ISCSpacer>> & string;
package/dist/types.d.ts CHANGED
@@ -162,14 +162,18 @@ declare const Button: ({ id, as, children, variant, mode, outlined, leftIcon, ri
162
162
 
163
163
  type ISpacer = {
164
164
  id?: string;
165
+ anchor?: string;
165
166
  color?: string;
166
167
  height?: keyof typeof spaces$1 | string | number;
167
168
  customHeight?: string;
169
+ customHeightTablet?: string;
170
+ customHeightMobile?: string;
168
171
  className?: string;
169
172
  style?: CSSProperties;
173
+ gradient?: string;
170
174
  };
171
175
 
172
- declare const Spacer: ({ id, color, customHeight, height, className, ...props }: ISpacer) => React__default.JSX.Element;
176
+ declare const Spacer: ({ id, color, customHeight, customHeightTablet, customHeightMobile, height, className, gradient }: ISpacer) => React__default.JSX.Element;
173
177
 
174
178
  type ISeparator = {
175
179
  color?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oddsgate-ds",
3
- "version": "1.0.157",
3
+ "version": "1.0.159",
4
4
  "description": "Miew theme component library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,27 +1,34 @@
1
- import { ISpacer } from './Spacer.interface'
2
- import React from 'react'
3
- import { StyledSpacer } from './Spacer.theme'
1
+ import { ISpacer } from './Spacer.interface';
2
+ import React from 'react';
3
+ import { StyledSpacer } from './Spacer.theme';
4
4
 
5
5
  const Spacer = ({
6
6
  id,
7
- color,
7
+ color = 'transparent',
8
8
  customHeight,
9
+ customHeightTablet,
10
+ customHeightMobile,
9
11
  height,
10
12
  className,
11
- ...props
13
+ gradient
14
+
12
15
  }: ISpacer) => {
16
+
17
+ const actualHeight = customHeight ?? `var(--space-${String(height)})`;
18
+ const actualHeightTablet = customHeightTablet ?? actualHeight;
19
+ const actualHeightMobile = customHeightMobile ?? actualHeight;
20
+
13
21
  return (
14
22
  <StyledSpacer
15
23
  id={id}
24
+ $color={ gradient ? gradient : color}
25
+ $height={actualHeight}
26
+ $customHeightTablet={actualHeightTablet}
27
+ $customHeightMobile={actualHeightMobile}
16
28
  className={className}
17
- style={{
18
- backgroundColor: color ? color : ``,
19
- height: customHeight ? customHeight : `var(--space-${String(height)})`
20
- }}
21
29
  aria-hidden="true"
22
- {...props}
23
30
  />
24
- )
25
- }
31
+ );
32
+ };
26
33
 
27
- export default Spacer
34
+ export default Spacer;
@@ -3,9 +3,22 @@ import { spaces } from '@/styles/variables';
3
3
 
4
4
  export type ISpacer = {
5
5
  id?: string
6
+ anchor?: string
6
7
  color?: string
7
8
  height?: keyof typeof spaces | string | number
8
9
  customHeight?: string
10
+ customHeightTablet?: string
11
+ customHeightMobile?: string
9
12
  className?: string;
10
- style?: CSSProperties
13
+ style?: CSSProperties;
14
+ gradient?: string;
11
15
  }
16
+
17
+
18
+
19
+ export type ISCSpacer = {
20
+ $color: ISpacer['color'];
21
+ $height: ISpacer['height'];
22
+ $customHeightTablet: ISpacer['customHeightTablet'];
23
+ $customHeightMobile: ISpacer['customHeightMobile'];
24
+ };
@@ -1,8 +1,6 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
-
3
- import { ISpacer } from '../Spacer/Spacer.interface'
4
- import React from 'react'
5
- import Spacer from '../Spacer/Spacer.component'
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import React from 'react';
3
+ import Spacer from '../Spacer/Spacer.component';
6
4
 
7
5
  // More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
8
6
  export default {
@@ -10,19 +8,92 @@ export default {
10
8
  component: Spacer,
11
9
  tags: ['autodocs'],
12
10
  argTypes: {
11
+ color: {
12
+ control: 'color',
13
+ description: 'Background color of the spacer',
14
+ table: {
15
+ type: { summary: 'string' },
16
+ },
17
+ },
18
+ gradient: {
19
+ control: 'select',
20
+ description: 'Background gradient of the spacer',
21
+ options: {
22
+ none: '',
23
+ Gradient: "linear-gradient(to right, #6776F7 0%, #FDBFFE 28%, #FC4D11 64%, #FFFD1C 100%)",
24
+ InvertedGradient: "linear-gradient(to left, #6776F7 0%, #FDBFFE 28%, #FC4D11 64%, #FFFD1C 100%)",
25
+ }
26
+ },
13
27
  height: {
14
- control: 'text'
28
+ control: 'text',
29
+ description: 'Default height of the spacer',
30
+ table: {
31
+ type: { summary: 'string' },
32
+ },
15
33
  },
16
- color: {
17
- control: 'color'
18
- }
19
- }
20
- } as Meta
34
+ customHeight: {
35
+ control: 'text',
36
+ description: 'Custom height of the spacer',
37
+ table: {
38
+ type: { summary: 'string' },
39
+ },
40
+ },
41
+ customHeightTablet: {
42
+ control: 'text',
43
+ description: 'Custom height for tablets',
44
+ table: {
45
+ type: { summary: 'string' },
46
+ },
47
+ },
48
+ customHeightMobile: {
49
+ control: 'text',
50
+ description: 'Custom height for mobile devices',
51
+ table: {
52
+ type: { summary: 'string' },
53
+ },
54
+ },
55
+ },
56
+ }
21
57
 
22
- export const Simple: StoryObj<ISpacer> = {
58
+ export const Simple: StoryObj<typeof Spacer> = {
23
59
  render: args => <Spacer {...args} />,
24
60
  args: {
61
+ color: '#000',
62
+ height: '20px',
25
63
  customHeight: '50px',
26
- color: '#000'
27
- }
28
- }
64
+ customHeightTablet: '40px',
65
+ customHeightMobile: '30px',
66
+ },
67
+ };
68
+ export const Gradient: StoryObj<typeof Spacer> = {
69
+ render: args => <Spacer {...args} />,
70
+ args: {
71
+ color: 'linear-gradient(to right, #6776F7 0%, #FDBFFE 28%, #FC4D11 64%, #FFFD1C 100%)',
72
+ height: '20px',
73
+ customHeight: '50px',
74
+ customHeightTablet: '40px',
75
+ customHeightMobile: '30px',
76
+ },
77
+ };
78
+
79
+ export const WithDifferentHeights: StoryObj<typeof Spacer> = {
80
+ render: args => <Spacer {...args} />,
81
+ args: {
82
+ color: '#f00',
83
+ height: '30px',
84
+ customHeight: '60px',
85
+ customHeightTablet: "500px",
86
+ customHeightMobile: '500px',
87
+ },
88
+ };
89
+
90
+ export const CustomColorAndHeight: StoryObj<typeof Spacer> = {
91
+ render: args => <Spacer {...args} />,
92
+ args: {
93
+ color: '#00f',
94
+ height: '10px',
95
+ customHeight: '20px',
96
+ customHeightTablet: '15px',
97
+ customHeightMobile: '10px',
98
+ },
99
+ };
@@ -1,7 +1,33 @@
1
- import styled, { css } from 'styled-components';
1
+ import styled, { css } from "styled-components";
2
+ import { ISCSpacer } from "./Spacer.interface";
3
+ import { variables } from "@/index";
2
4
 
3
- import { ISpacer } from './Spacer.interface';
5
+ export const StyledSpacer = styled.div<ISCSpacer>`
6
+ ${({ $color }) =>
7
+ $color &&
8
+ css`
9
+ background: ${$color};
10
+ `}
4
11
 
5
- export const StyledSpacer = styled.div<ISpacer>`
6
- width: 100%;
12
+ ${({ $height }) =>
13
+ css`
14
+ height: ${$height};
15
+ `}
16
+
17
+
18
+ ${({ $customHeightTablet }) =>
19
+ $customHeightTablet &&
20
+ css`
21
+ @media (max-width: ${variables.desktop_width}px) {
22
+ height: ${$customHeightTablet};
23
+ }
24
+ `}
25
+
26
+ ${({ $customHeightMobile }) =>
27
+ $customHeightMobile &&
28
+ css`
29
+ @media (max-width: ${variables.tablet_width}px) {
30
+ height: ${$customHeightMobile};
31
+ }
32
+ `}
7
33
  `;