pixel-react 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pixel-react",
3
3
  "description": "Great for pixel-perfect, design-focused components in React",
4
- "version": "1.0.7",
4
+ "version": "1.0.8",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
7
7
  "types": "lib/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
2
  import { Container, Row, Col } from './GridLayout';
3
- import './GridLayoutStory.scss'
3
+ import './GridLayoutStory.scss';
4
4
 
5
5
  const meta: Meta<typeof Container> = {
6
6
  title: 'Components/GridLayout',
@@ -27,31 +27,21 @@ export const Grid: ContainerStory = {
27
27
  <Container {...args}>
28
28
  <Row>
29
29
  <Col size={4}>
30
- <div className='one'>
31
- Column 1
32
- </div>
30
+ <div className="one">Column 1</div>
33
31
  </Col>
34
32
  <Col size={4}>
35
- <div className='two'>
36
- Column 2
37
- </div>
33
+ <div className="two">Column 2</div>
38
34
  </Col>
39
35
  <Col size={4}>
40
- <div className='three'>
41
- Column 3
42
- </div>
36
+ <div className="three">Column 3</div>
43
37
  </Col>
44
38
  </Row>
45
39
  <Row>
46
40
  <Col size={6}>
47
- <div className='four'>
48
- Column 4
49
- </div>
41
+ <div className="four">Column 4</div>
50
42
  </Col>
51
43
  <Col size={6}>
52
- <div className='five'>
53
- Column 5
54
- </div>
44
+ <div className="five">Column 5</div>
55
45
  </Col>
56
46
  </Row>
57
47
  </Container>
@@ -67,57 +57,29 @@ export const Grid2: ContainerStory = {
67
57
  <Container {...args}>
68
58
  <Row gap="20px">
69
59
  <Col size={3}>
70
- <div
71
- className='one'
72
- >
73
- Column 1 (size 3)
74
- </div>
60
+ <div className="one">Column 1 (size 3)</div>
75
61
  </Col>
76
62
  <Col size={6}>
77
- <div
78
- className='two'
79
- >
80
- Column 2 (size 6)
81
- </div>
63
+ <div className="two">Column 2 (size 6)</div>
82
64
  </Col>
83
65
  <Col size={3}>
84
- <div
85
- className='three'
86
- >
87
- Column 3 (size 3)
88
- </div>
66
+ <div className="three">Column 3 (size 3)</div>
89
67
  </Col>
90
68
  </Row>
91
69
  <Row gap="10px">
92
70
  <Col size={4}>
93
- <div
94
- className='four'
95
- >
96
- Column 4 (size 4)
97
- </div>
71
+ <div className="four">Column 4 (size 4)</div>
98
72
  </Col>
99
73
  <Col size={4}>
100
- <div
101
- className='five'
102
- >
103
- Column 5 (size 4)
104
- </div>
74
+ <div className="five">Column 5 (size 4)</div>
105
75
  </Col>
106
76
  <Col size={4}>
107
- <div
108
- className='one'
109
- >
110
- Column 6 (size 4)
111
- </div>
77
+ <div className="one">Column 6 (size 4)</div>
112
78
  </Col>
113
79
  </Row>
114
80
  <Row gap="15px">
115
81
  <Col size={12}>
116
- <div
117
- className='two'
118
- >
119
- Full-width column (size 12)
120
- </div>
82
+ <div className="two">Full-width column (size 12)</div>
121
83
  </Col>
122
84
  </Row>
123
85
  </Container>
@@ -2,29 +2,31 @@
2
2
  import React from 'react';
3
3
  import './GridLayout.scss';
4
4
  import { ContainerProps, RowProps, ColProps } from './types';
5
+ import cx from 'classnames'
5
6
 
6
7
  export const Container: React.FC<ContainerProps> = ({
7
8
  children,
8
9
  fluid = false,
9
10
  gap = '0px',
11
+ className=''
10
12
  }) => {
11
- const className = fluid ? 'ff-container-fluid' : 'ff-container';
13
+ const containerClassName = fluid ? 'ff-container-fluid' : 'ff-container';
12
14
  return (
13
- <div className={className} style={{ gap }}>
15
+ <div className={cx(containerClassName,className)} style={{ gap }}>
14
16
  {children}
15
17
  </div>
16
18
  );
17
19
  };
18
20
 
19
- export const Row: React.FC<RowProps> = ({ children, gap = '0px' }) => {
21
+ export const Row: React.FC<RowProps> = ({ children, gap = '0px',className='' }) => {
20
22
  return (
21
- <div className="ff-row" style={{ gap }}>
23
+ <div className={cx("ff-row",className)} style={{ gap }}>
22
24
  {children}
23
25
  </div>
24
26
  );
25
27
  };
26
28
 
27
- export const Col: React.FC<ColProps> = ({ children, size = 12 }) => {
28
- const className = `ff-col-${size}`;
29
- return <div className={className}>{children}</div>;
29
+ export const Col: React.FC<ColProps> = ({ children, size = 12,className='' }) => {
30
+ const colClassName = `ff-col-${size}`;
31
+ return <div className={cx(colClassName,className)}>{children}</div>;
30
32
  };
@@ -25,6 +25,13 @@ export interface ContainerProps {
25
25
  * @type {string}
26
26
  */
27
27
  gap?: string;
28
+
29
+ /**
30
+ * Classname for Container
31
+ * @default ''
32
+ * @type {string}
33
+ */
34
+ className?:string
28
35
  }
29
36
 
30
37
  export interface RowProps {
@@ -43,6 +50,12 @@ export interface RowProps {
43
50
  * @type {string}
44
51
  */
45
52
  gap?: string;
53
+
54
+ /**
55
+ * @default ''
56
+ * @type string
57
+ */
58
+ className?:string
46
59
  }
47
60
 
48
61
  export interface ColProps {
@@ -61,4 +74,11 @@ export interface ColProps {
61
74
  * @type {number}
62
75
  */
63
76
  size?: number;
77
+
78
+ /**
79
+ * @default ''
80
+ * @type string
81
+ *
82
+ */
83
+ className?: string;
64
84
  }
@@ -1,8 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { ThemeContextType } from './types';
3
- declare const ThemeContext: React.Context<ThemeContextType | undefined>;
4
- declare const CustomThemeProvider: React.FC<{
5
- children: ReactNode;
6
- }>;
7
- export { ThemeContext };
8
- export default CustomThemeProvider;
@@ -1,11 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- interface ThemeContextType {
3
- currentTheme: string;
4
- setCurrentTheme: React.Dispatch<React.SetStateAction<string>>;
5
- applyTheme: (newTheme: string) => void;
6
- }
7
- export declare const useCustomThemeProvider: React.FC<{
8
- children: ReactNode;
9
- }>;
10
- export declare const useTheme: () => ThemeContextType;
11
- export {};