@dtdot/lego 0.17.15 → 0.17.19
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/build/components/Button/Button.component.js +3 -3
- package/build/components/Button/Button.context.d.ts +1 -0
- package/build/components/Button/Button.context.js +1 -0
- package/build/components/Table/Table.component.d.ts +1 -0
- package/build/components/Table/Table.component.js +5 -1
- package/build/components/Table/Table.stories.d.ts +1 -0
- package/build/components/Table/Table.stories.js +36 -0
- package/build/components/Table/_TableAction.d.ts +7 -0
- package/build/components/Table/_TableAction.js +6 -0
- package/package.json +2 -3
|
@@ -3,7 +3,6 @@ import styled, { keyframes } from 'styled-components';
|
|
|
3
3
|
import getThemeVariantColours from '../../theme/helpers/getThemeVariantColours';
|
|
4
4
|
import ButtonContext from './Button.context';
|
|
5
5
|
const StyledButton = styled.button `
|
|
6
|
-
height: 48px;
|
|
7
6
|
outline: none;
|
|
8
7
|
box-shadow: none;
|
|
9
8
|
border: none;
|
|
@@ -21,6 +20,7 @@ const StyledButton = styled.button `
|
|
|
21
20
|
border-radius: 2px;
|
|
22
21
|
|
|
23
22
|
// Props defined by the context
|
|
23
|
+
height: ${(props) => props.height || '48px'};
|
|
24
24
|
width: ${(props) => props.width};
|
|
25
25
|
align-self: ${(props) => props.alignSelf};
|
|
26
26
|
margin-top: ${(props) => props.marginTop};
|
|
@@ -54,7 +54,7 @@ const ButtonSpinner = styled.div `
|
|
|
54
54
|
}
|
|
55
55
|
`;
|
|
56
56
|
const Button = ({ children, loading, variant = 'primary', type, onClick }) => {
|
|
57
|
-
const { width, alignSelf, marginTop } = useContext(ButtonContext);
|
|
58
|
-
return (React.createElement(StyledButton, { width: width, alignSelf: alignSelf, marginTop: marginTop, variant: variant, type: type, onClick: onClick }, loading ? React.createElement(ButtonSpinner, { variant: variant }) : children));
|
|
57
|
+
const { width, height, alignSelf, marginTop } = useContext(ButtonContext);
|
|
58
|
+
return (React.createElement(StyledButton, { width: width, height: height, alignSelf: alignSelf, marginTop: marginTop, variant: variant, type: type, onClick: onClick }, loading ? React.createElement(ButtonSpinner, { variant: variant }) : children));
|
|
59
59
|
};
|
|
60
60
|
export default Button;
|
|
@@ -12,5 +12,6 @@ declare const Table: {
|
|
|
12
12
|
({ children, variant }: TableProps): JSX.Element;
|
|
13
13
|
Row: ({ children }: import("./_TableRow.component").TableRowProps) => JSX.Element;
|
|
14
14
|
Cell: import("styled-components").StyledComponent<"td", import("styled-components").DefaultTheme, TableCellProps, never>;
|
|
15
|
+
Action: ({ text, onClick }: import("./_TableAction").TableActionProps) => JSX.Element;
|
|
15
16
|
};
|
|
16
17
|
export default Table;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
+
import ButtonContext from '../Button/Button.context';
|
|
3
4
|
import TableContext from './_Table.context';
|
|
5
|
+
import TableAction from './_TableAction';
|
|
4
6
|
import TableRow from './_TableRow.component';
|
|
5
7
|
const StyledTable = styled.table `
|
|
6
8
|
width: 100%;
|
|
@@ -17,8 +19,10 @@ const TableCell = styled.td `
|
|
|
17
19
|
`;
|
|
18
20
|
const Table = ({ children, variant = 'regular' }) => {
|
|
19
21
|
return (React.createElement(TableContext.Provider, { value: { variant } },
|
|
20
|
-
React.createElement(
|
|
22
|
+
React.createElement(ButtonContext.Provider, { value: { height: '24px' } },
|
|
23
|
+
React.createElement(StyledTable, null, children))));
|
|
21
24
|
};
|
|
22
25
|
Table.Row = TableRow;
|
|
23
26
|
Table.Cell = TableCell;
|
|
27
|
+
Table.Action = TableAction;
|
|
24
28
|
export default Table;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Meta } from '@storybook/react/types-6-0';
|
|
3
3
|
export declare const Standard: () => JSX.Element;
|
|
4
|
+
export declare const WithActions: () => JSX.Element;
|
|
4
5
|
export declare const InCard: () => JSX.Element;
|
|
5
6
|
export declare const InContentCard: () => JSX.Element;
|
|
6
7
|
declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
|
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Card, ProfileImage, Table } from '../..';
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
4
|
+
const fakeData = [
|
|
5
|
+
{
|
|
6
|
+
count: 57,
|
|
7
|
+
name: 'Hungry Caterpillar',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
count: 32,
|
|
11
|
+
name: 'Fainting Lama',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
count: 53,
|
|
15
|
+
name: 'Hungry Bear',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
count: 24,
|
|
19
|
+
name: 'Panicking Squirrel',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
count: 12,
|
|
23
|
+
name: 'High Hedgehog',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
count: 76,
|
|
27
|
+
name: 'Lazy Tiger',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
count: 34,
|
|
31
|
+
name: 'Wild Antelope',
|
|
32
|
+
},
|
|
33
|
+
];
|
|
3
34
|
export const Standard = () => (React.createElement(Table, null,
|
|
4
35
|
React.createElement(Table.Row, null,
|
|
5
36
|
React.createElement(Table.Cell, { variant: 'tight' },
|
|
@@ -11,6 +42,11 @@ export const Standard = () => (React.createElement(Table, null,
|
|
|
11
42
|
React.createElement(ProfileImage, { name: 'Fainting Lama' })),
|
|
12
43
|
React.createElement(Table.Cell, { width: '100%' }, "Fainting Lama"),
|
|
13
44
|
React.createElement(Table.Cell, null, "Pending"))));
|
|
45
|
+
export const WithActions = () => (React.createElement(Table, null, fakeData.map((data) => (React.createElement(Table.Row, { key: data.name },
|
|
46
|
+
React.createElement(Table.Cell, null, data.count),
|
|
47
|
+
React.createElement(Table.Cell, null, data.name),
|
|
48
|
+
React.createElement(Table.Cell, null,
|
|
49
|
+
React.createElement(Table.Action, { onClick: () => { }, text: 'filter' })))))));
|
|
14
50
|
export const InCard = () => (React.createElement(Card, { padded: true, size: 'sm' },
|
|
15
51
|
React.createElement(Table, null,
|
|
16
52
|
React.createElement(Table.Row, null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dtdot/lego",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.19",
|
|
4
4
|
"description": "Some reusable components for building my applications",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"eslint-plugin-prettier": "^3.4.1",
|
|
41
41
|
"eslint-plugin-react": "^7.28.0",
|
|
42
42
|
"eslint-plugin-react-hooks": "^4.3.0",
|
|
43
|
-
"framer-motion": "^6.2.6",
|
|
44
43
|
"prettier": "^2.5.1",
|
|
45
44
|
"prettier-eslint": "^12.0.0",
|
|
46
45
|
"react": "^17.0.2",
|
|
@@ -50,7 +49,6 @@
|
|
|
50
49
|
"typescript": "^4.5.5"
|
|
51
50
|
},
|
|
52
51
|
"peerDependencies": {
|
|
53
|
-
"framer-motion": "^6.2.6",
|
|
54
52
|
"react": "^17.0.1",
|
|
55
53
|
"react-dom": "^17.0.1",
|
|
56
54
|
"styled-components": "^5.2.1"
|
|
@@ -59,6 +57,7 @@
|
|
|
59
57
|
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
|
60
58
|
"@fortawesome/free-solid-svg-icons": "^5.15.4",
|
|
61
59
|
"@fortawesome/react-fontawesome": "^0.1.13",
|
|
60
|
+
"framer-motion": "^6.2.8",
|
|
62
61
|
"identicon.js": "^2.3.3",
|
|
63
62
|
"qrcode": "^1.5.0",
|
|
64
63
|
"react-use-measure": "^2.1.1",
|