enwawa-ui 1.0.7
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/.babelrc.json +16 -0
- package/.eslintrc.cjs +37 -0
- package/.husky/pre-commit +6 -0
- package/.prettierignore +6 -0
- package/.prettierrc +4 -0
- package/.storybook/main.ts +21 -0
- package/.storybook/preview.tsx +57 -0
- package/.vscode/settings.json +14 -0
- package/CHANGELOG.md +118 -0
- package/auto.config.ts +34 -0
- package/constants.ts +1 -0
- package/createIndexes.js +34 -0
- package/index.ts +5 -0
- package/package.json +94 -0
- package/placeholder.ts +1 -0
- package/readme.md +1 -0
- package/rollup.config.mjs +48 -0
- package/stories/Introduction.mdx +221 -0
- package/stories/assets/backgrounds/bg-1.png +0 -0
- package/stories/assets/carousel/login/1st.png +0 -0
- package/stories/assets/icons/code-brackets.svg +1 -0
- package/stories/assets/icons/colors.svg +1 -0
- package/stories/assets/icons/comments.svg +1 -0
- package/stories/assets/icons/direction.svg +1 -0
- package/stories/assets/icons/flow.svg +1 -0
- package/stories/assets/icons/plugin.svg +1 -0
- package/stories/assets/icons/repo.svg +1 -0
- package/stories/assets/icons/stackalt.svg +1 -0
- package/stories/assets/icons/wawa-isotype.svg +4 -0
- package/stories/assets/icons/wawa-logo.svg +6 -0
- package/stories/atoms/AtAvatar/AtAvatar.stories.tsx +61 -0
- package/stories/atoms/AtAvatar/index.tsx +46 -0
- package/stories/atoms/AtButton/AtButton.stories.ts +88 -0
- package/stories/atoms/AtButton/index.tsx +69 -0
- package/stories/atoms/AtButton/styles.ts +13 -0
- package/stories/atoms/AtCheckBox/AtCheckBox.stories.tsx +30 -0
- package/stories/atoms/AtCheckBox/index.tsx +38 -0
- package/stories/atoms/AtDatePicker/AtDatePicker.stories.tsx +45 -0
- package/stories/atoms/AtDatePicker/index.tsx +93 -0
- package/stories/atoms/AtDivider/AtDivider.stories.tsx +57 -0
- package/stories/atoms/AtDivider/index.tsx +44 -0
- package/stories/atoms/AtImage/AtImage.stories.tsx +66 -0
- package/stories/atoms/AtImage/index.tsx +41 -0
- package/stories/atoms/AtLogo/AtLogo.stories.ts +47 -0
- package/stories/atoms/AtLogo/index.tsx +22 -0
- package/stories/atoms/AtLogo/styles.ts +26 -0
- package/stories/atoms/AtNumberInput/AtNumberInput.stories.ts +40 -0
- package/stories/atoms/AtNumberInput/index.tsx +138 -0
- package/stories/atoms/AtNumberInput/styles.tsx +7 -0
- package/stories/atoms/AtPasswordInput/AtPasswordInput.stories.ts +24 -0
- package/stories/atoms/AtPasswordInput/index.tsx +11 -0
- package/stories/atoms/AtRadio/AtRadio.stories.tsx +36 -0
- package/stories/atoms/AtRadio/index.tsx +44 -0
- package/stories/atoms/AtSelect/AtSelect.stories.tsx +132 -0
- package/stories/atoms/AtSelect/index.tsx +229 -0
- package/stories/atoms/AtSelect/styles.tsx +8 -0
- package/stories/atoms/AtText/AtText.stories.ts +104 -0
- package/stories/atoms/AtText/index.tsx +65 -0
- package/stories/atoms/AtTextInput/AtTextInput.stories.ts +40 -0
- package/stories/atoms/AtTextInput/index.tsx +85 -0
- package/stories/atoms/AtTitle/AtTitle.stories.ts +103 -0
- package/stories/atoms/AtTitle/index.tsx +77 -0
- package/stories/atoms/AtTitle/styles.ts +7 -0
- package/stories/atoms/index.ts +14 -0
- package/stories/molecules/MlBreadCrumb/MlBreadCrumb.stories.tsx +123 -0
- package/stories/molecules/MlBreadCrumb/index.tsx +29 -0
- package/stories/molecules/MlCard/MlCard.stories.tsx +55 -0
- package/stories/molecules/MlCard/index.tsx +100 -0
- package/stories/molecules/MlCard/styles.tsx +22 -0
- package/stories/molecules/MlCarousel/MlCarousel.stories.tsx +98 -0
- package/stories/molecules/MlCarousel/index.tsx +67 -0
- package/stories/molecules/MlDropdown/MlDropdown.stories.tsx +121 -0
- package/stories/molecules/MlDropdown/index.tsx +97 -0
- package/stories/molecules/MlFormItem/MlFormItem.stories.tsx +33 -0
- package/stories/molecules/MlFormItem/index.tsx +100 -0
- package/stories/molecules/MlRadioGroup/MlRadioGroup.stories.ts +40 -0
- package/stories/molecules/MlRadioGroup/index.tsx +60 -0
- package/stories/molecules/index.ts +6 -0
- package/stories/organisms/OrAlert/OrAlert.stories.tsx +136 -0
- package/stories/organisms/OrAlert/index.tsx +64 -0
- package/stories/organisms/OrCol/OrCol.stories.tsx +33 -0
- package/stories/organisms/OrCol/index.tsx +108 -0
- package/stories/organisms/OrCol/styles.ts +86 -0
- package/stories/organisms/OrContent/index.tsx +6 -0
- package/stories/organisms/OrCountryCard/OrCountryCard.stories.ts +19 -0
- package/stories/organisms/OrCountryCard/index.tsx +55 -0
- package/stories/organisms/OrFlagGrid/OrFlagGrid.stories.ts +41 -0
- package/stories/organisms/OrFlagGrid/index.tsx +54 -0
- package/stories/organisms/OrFrom/index.tsx +10 -0
- package/stories/organisms/OrHeader/index.tsx +6 -0
- package/stories/organisms/OrLayout/index.tsx +6 -0
- package/stories/organisms/OrLoginLayout/OrLoginLayout.stories.tsx +34 -0
- package/stories/organisms/OrLoginLayout/index.tsx +63 -0
- package/stories/organisms/OrLoginLayout/styles.tsx +16 -0
- package/stories/organisms/OrRow/OrRow.stories.tsx +48 -0
- package/stories/organisms/OrRow/index.tsx +71 -0
- package/stories/organisms/OrRow/styles.ts +24 -0
- package/stories/organisms/OrSider/index.tsx +6 -0
- package/stories/organisms/OrSimpleBanner/OrSimpleBanner.stories.ts +18 -0
- package/stories/organisms/OrSimpleBanner/index.tsx +26 -0
- package/stories/organisms/OrSimpleBanner/styles.ts +12 -0
- package/stories/organisms/OrSpace/OrSpace.stories.tsx +169 -0
- package/stories/organisms/OrSpace/index.tsx +43 -0
- package/stories/organisms/OrSpaceCompact/OrSpaceCompact.stories.tsx +94 -0
- package/stories/organisms/OrSpaceCompact/index.tsx +35 -0
- package/stories/organisms/index.ts +14 -0
- package/stories/templates/TmLoginCountry/TmLoginCountry.stories.ts +44 -0
- package/stories/templates/TmLoginCountry/index.tsx +64 -0
- package/stories/templates/TmLoginCountry/styles.tsx +14 -0
- package/stories/templates/TmLoginPhone/TmLoginPhone.stories.tsx +49 -0
- package/stories/templates/TmLoginPhone/index.tsx +191 -0
- package/stories/templates/TmLoginPhone/styles.tsx +31 -0
- package/stories/templates/index.ts +2 -0
- package/theme.tsx +56 -0
- package/tsconfig.json +38 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Alert, AlertProps } from 'antd';
|
|
3
|
+
|
|
4
|
+
interface OrAlertProps {
|
|
5
|
+
/**
|
|
6
|
+
* The action of Alert
|
|
7
|
+
*/
|
|
8
|
+
action?: AlertProps['action'];
|
|
9
|
+
/**
|
|
10
|
+
* Called when close animation is finished
|
|
11
|
+
*/
|
|
12
|
+
afterClose?: AlertProps['afterClose'];
|
|
13
|
+
/**
|
|
14
|
+
* Whether to show as banner
|
|
15
|
+
*/
|
|
16
|
+
banner?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Custom close icon, >=5.7.0: close button will be hidden when setting to null or false
|
|
19
|
+
*/
|
|
20
|
+
closeIcon?: boolean | React.ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Closable text to show
|
|
23
|
+
*/
|
|
24
|
+
closable?: AlertProps['closable'];
|
|
25
|
+
/**
|
|
26
|
+
* Additional content of Alert
|
|
27
|
+
*/
|
|
28
|
+
description?: AlertProps['description'];
|
|
29
|
+
/**
|
|
30
|
+
* Custom icon, effective when showIcon is true
|
|
31
|
+
*/
|
|
32
|
+
icon?: AlertProps['icon'];
|
|
33
|
+
/**
|
|
34
|
+
* Content of Alert
|
|
35
|
+
*/
|
|
36
|
+
message?: AlertProps['message'];
|
|
37
|
+
/**
|
|
38
|
+
* Whether to show icon
|
|
39
|
+
*/
|
|
40
|
+
showIcon?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Type of Alert styles, options: success, info, warning, error
|
|
43
|
+
*/
|
|
44
|
+
type?: AlertProps['type'];
|
|
45
|
+
/**
|
|
46
|
+
* Callback when Alert is closed
|
|
47
|
+
*/
|
|
48
|
+
onClose?: AlertProps['onClose'];
|
|
49
|
+
/**
|
|
50
|
+
* Children of Alert
|
|
51
|
+
*/
|
|
52
|
+
children?: React.ReactNode;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const OrAlert: React.FC<OrAlertProps> = (props) => {
|
|
56
|
+
return (
|
|
57
|
+
<Alert {...props} >{props.children}</Alert>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
OrAlert.defaultProps = {
|
|
62
|
+
afterClose: undefined,
|
|
63
|
+
banner: false,
|
|
64
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { OrCol } from '.';
|
|
3
|
+
import { AtButton } from '../../atoms/AtButton';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { OrRow } from '../OrRow';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Organisms/OrCol',
|
|
9
|
+
component: OrCol,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
} satisfies Meta<typeof OrCol>;
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
|
|
17
|
+
export const Basic: Story = {
|
|
18
|
+
args: {
|
|
19
|
+
id: '1',
|
|
20
|
+
span: 8,
|
|
21
|
+
},
|
|
22
|
+
render: (args) => {
|
|
23
|
+
return (
|
|
24
|
+
<OrRow>
|
|
25
|
+
{new Array(3).fill(null).map((_, index) => (
|
|
26
|
+
<OrCol {...args}>
|
|
27
|
+
<AtButton key={index} value={`AtButton-${index}`} />
|
|
28
|
+
</OrCol>
|
|
29
|
+
))}
|
|
30
|
+
</OrRow>
|
|
31
|
+
);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyledCol } from './styles';
|
|
3
|
+
|
|
4
|
+
export interface OrColProps {
|
|
5
|
+
/**
|
|
6
|
+
* The ID for input
|
|
7
|
+
*/
|
|
8
|
+
id?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Flex layout style
|
|
11
|
+
*/
|
|
12
|
+
flex?: string | number;
|
|
13
|
+
/**
|
|
14
|
+
* The number of cells to offset Col from the left
|
|
15
|
+
*/
|
|
16
|
+
offset?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Raster order
|
|
19
|
+
*/
|
|
20
|
+
order?: number;
|
|
21
|
+
/**
|
|
22
|
+
* The number of cells that raster is moved to the left
|
|
23
|
+
*/
|
|
24
|
+
pull?: number;
|
|
25
|
+
/**
|
|
26
|
+
* The number of cells that raster is moved to the right
|
|
27
|
+
*/
|
|
28
|
+
push?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Raster number of cells to occupy, 0 corresponds to display: none
|
|
31
|
+
*/
|
|
32
|
+
span?: number;
|
|
33
|
+
/**
|
|
34
|
+
* screen < 576px and also default setting, could be a span value or an object containing above props
|
|
35
|
+
*/
|
|
36
|
+
xs?: number | object;
|
|
37
|
+
/**
|
|
38
|
+
* screen ≥ 576px, could be a span value or an object containing above props
|
|
39
|
+
*/
|
|
40
|
+
sm?: number | object;
|
|
41
|
+
/**
|
|
42
|
+
* screen ≥ 768px, could be a span value or an object containing above props
|
|
43
|
+
*/
|
|
44
|
+
md?: number | object;
|
|
45
|
+
/**
|
|
46
|
+
* screen ≥ 1200px, could be a span value or an object containing above props
|
|
47
|
+
*/
|
|
48
|
+
xl?: number | object;
|
|
49
|
+
/**
|
|
50
|
+
* screen ≥ 1600px, could be a span value or an object containing above props
|
|
51
|
+
*/
|
|
52
|
+
xxl?: number | object;
|
|
53
|
+
/**
|
|
54
|
+
* Children of Columns
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
children?: React.ReactElement | React.ReactElement[];
|
|
58
|
+
/**
|
|
59
|
+
* Container background source
|
|
60
|
+
*/
|
|
61
|
+
$backgroundSrc?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Justify content
|
|
64
|
+
*/
|
|
65
|
+
$justify?:
|
|
66
|
+
| 'start'
|
|
67
|
+
| 'end'
|
|
68
|
+
| 'center'
|
|
69
|
+
| 'space-around'
|
|
70
|
+
| 'space-between'
|
|
71
|
+
| 'space-evenly';
|
|
72
|
+
/**
|
|
73
|
+
* Container padding top in px
|
|
74
|
+
*/
|
|
75
|
+
$paddingTop?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Container padding Bottom in px
|
|
78
|
+
*/
|
|
79
|
+
$paddingBottom?: number;
|
|
80
|
+
/**
|
|
81
|
+
* Container padding Right in px
|
|
82
|
+
*/
|
|
83
|
+
$paddingRight?: number;
|
|
84
|
+
/**
|
|
85
|
+
* Container padding Left in px
|
|
86
|
+
*/
|
|
87
|
+
$paddingLeft?: number;
|
|
88
|
+
/**
|
|
89
|
+
* Container padding Vertical in px
|
|
90
|
+
*/
|
|
91
|
+
$paddingVertical?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Container padding Horizontal in px
|
|
94
|
+
*/
|
|
95
|
+
$paddingHorizontal?: number;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export const OrCol: React.FC<OrColProps> = (props) => {
|
|
99
|
+
return <StyledCol {...props}>{props.children}</StyledCol>;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
OrCol.defaultProps = {
|
|
103
|
+
offset: 0,
|
|
104
|
+
order: 0,
|
|
105
|
+
pull: 0,
|
|
106
|
+
push: 0,
|
|
107
|
+
span: 0,
|
|
108
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { styled } from 'styled-components';
|
|
2
|
+
import { OrColProps } from '.';
|
|
3
|
+
import { Col } from 'antd';
|
|
4
|
+
|
|
5
|
+
export const StyledCol = styled(Col)<OrColProps>`
|
|
6
|
+
${({ xs }) =>
|
|
7
|
+
(xs as any)?.hidden === true || (xs as number) === 0
|
|
8
|
+
? ''
|
|
9
|
+
: 'display: flex;'}
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
${({ $backgroundSrc }) =>
|
|
12
|
+
$backgroundSrc ? `background-image: url(${$backgroundSrc})` : ''};
|
|
13
|
+
${({ $justify }) => ($justify ? `justify-content: ${$justify}` : '')};
|
|
14
|
+
object-fit: cover;
|
|
15
|
+
${({ xs, $paddingTop }) =>
|
|
16
|
+
(xs as any)?.$paddingTop || $paddingTop !== undefined
|
|
17
|
+
? `padding-top: ${(xs as any)?.$paddingTop ?? $paddingTop}px`
|
|
18
|
+
: ''};
|
|
19
|
+
${({ xs, $paddingBottom }) =>
|
|
20
|
+
(xs as any)?.$paddingBottom || $paddingBottom !== undefined
|
|
21
|
+
? `padding-bottom: ${(xs as any)?.$paddingBottom ?? $paddingBottom}px`
|
|
22
|
+
: ''};
|
|
23
|
+
${({ xs, $paddingRight }) =>
|
|
24
|
+
(xs as any)?.$paddingRight || $paddingRight !== undefined
|
|
25
|
+
? `padding-right: ${(xs as any)?.$paddingRight ?? $paddingRight}px`
|
|
26
|
+
: ''};
|
|
27
|
+
${({ xs, $paddingLeft }) =>
|
|
28
|
+
(xs as any)?.$paddingLeft || $paddingLeft !== undefined
|
|
29
|
+
? `padding-left: ${(xs as any)?.$paddingLeft ?? $paddingLeft}px`
|
|
30
|
+
: ''};
|
|
31
|
+
${({ xs, $paddingVertical }) =>
|
|
32
|
+
(xs as any)?.$paddingVertical || $paddingVertical !== undefined
|
|
33
|
+
? `padding-top: ${
|
|
34
|
+
(xs as any)?.$paddingVertical ?? $paddingVertical
|
|
35
|
+
}px; padding-bottom: ${
|
|
36
|
+
(xs as any)?.$paddingVertical ?? $paddingVertical
|
|
37
|
+
}px`
|
|
38
|
+
: ''};
|
|
39
|
+
${({ xs, $paddingHorizontal }) =>
|
|
40
|
+
(xs as any)?.$paddingHorizontal
|
|
41
|
+
? `padding-left: ${
|
|
42
|
+
(xs as any)?.$paddingHorizontal ?? $paddingHorizontal
|
|
43
|
+
}px; padding-right: ${
|
|
44
|
+
(xs as any)?.$paddingHorizontal ?? $paddingHorizontal
|
|
45
|
+
}px`
|
|
46
|
+
: ''};
|
|
47
|
+
|
|
48
|
+
@media (min-width: 768px) {
|
|
49
|
+
${({ md }) =>
|
|
50
|
+
(md as any)?.hidden === true || (md as number) === 0
|
|
51
|
+
? ''
|
|
52
|
+
: 'display: flex;'}
|
|
53
|
+
${({ md, $paddingTop }) =>
|
|
54
|
+
(md as any)?.$paddingTop || $paddingTop !== undefined
|
|
55
|
+
? `padding-top: ${(md as any)?.$paddingTop ?? $paddingTop}px`
|
|
56
|
+
: ''};
|
|
57
|
+
${({ md, $paddingBottom }) =>
|
|
58
|
+
(md as any)?.$paddingBottom || $paddingBottom !== undefined
|
|
59
|
+
? `padding-bottom: ${(md as any)?.$paddingBottom ?? $paddingBottom}px`
|
|
60
|
+
: ''};
|
|
61
|
+
${({ md, $paddingRight }) =>
|
|
62
|
+
(md as any)?.$paddingRight || $paddingRight !== undefined
|
|
63
|
+
? `padding-right: ${(md as any)?.$paddingRight ?? $paddingRight}px`
|
|
64
|
+
: ''};
|
|
65
|
+
${({ md, $paddingLeft }) =>
|
|
66
|
+
(md as any)?.$paddingLeft || $paddingLeft !== undefined
|
|
67
|
+
? `padding-left: ${(md as any)?.$paddingLeft ?? $paddingLeft}px`
|
|
68
|
+
: ''};
|
|
69
|
+
${({ md, $paddingVertical }) =>
|
|
70
|
+
(md as any)?.$paddingVertical || $paddingVertical !== undefined
|
|
71
|
+
? `padding-top: ${
|
|
72
|
+
(md as any)?.$paddingVertical ?? $paddingVertical
|
|
73
|
+
}px; padding-bottom: ${
|
|
74
|
+
(md as any)?.$paddingVertical ?? $paddingVertical
|
|
75
|
+
}px`
|
|
76
|
+
: ''};
|
|
77
|
+
${({ md, $paddingHorizontal }) =>
|
|
78
|
+
(md as any)?.$paddingHorizontal
|
|
79
|
+
? `padding-left: ${
|
|
80
|
+
(md as any)?.$paddingHorizontal ?? $paddingHorizontal
|
|
81
|
+
}px; padding-right: ${
|
|
82
|
+
(md as any)?.$paddingHorizontal ?? $paddingHorizontal
|
|
83
|
+
}px`
|
|
84
|
+
: ''};
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { OrCountryCard } from '.';
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Organisms/OrCountryCard',
|
|
6
|
+
component: OrCountryCard,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
} satisfies Meta<typeof OrCountryCard>;
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
|
|
13
|
+
export const Basic: Story = {
|
|
14
|
+
args: {
|
|
15
|
+
name: 'Venezuela',
|
|
16
|
+
flagSrc:
|
|
17
|
+
'https://upload.wikimedia.org/wikipedia/commons/0/06/Flag_of_Venezuela.svg',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MlCard } from '../../molecules';
|
|
3
|
+
import { AtText } from '../../atoms/AtText';
|
|
4
|
+
import SVG from 'react-inlinesvg';
|
|
5
|
+
import { OrRow, OrCol } from '../../organisms';
|
|
6
|
+
export interface OrCountryCardProps {
|
|
7
|
+
/**
|
|
8
|
+
* The ID for card
|
|
9
|
+
*/
|
|
10
|
+
id?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Country name
|
|
13
|
+
**/
|
|
14
|
+
name: string;
|
|
15
|
+
/**
|
|
16
|
+
* Country flag url
|
|
17
|
+
**/
|
|
18
|
+
flagSrc: string;
|
|
19
|
+
/**
|
|
20
|
+
* Mark item as selected
|
|
21
|
+
*/
|
|
22
|
+
selected?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Callback when card is clicked
|
|
25
|
+
*/
|
|
26
|
+
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const OrCountryCard: React.FC<OrCountryCardProps> = (props) => {
|
|
30
|
+
return (
|
|
31
|
+
<MlCard
|
|
32
|
+
selected={props.selected}
|
|
33
|
+
hoverable={true}
|
|
34
|
+
bodyStyle={{ padding: '12px 24px' }}
|
|
35
|
+
onClick={props.onClick}
|
|
36
|
+
>
|
|
37
|
+
<OrRow
|
|
38
|
+
align={'middle'}
|
|
39
|
+
justify={{ xs: 'center', md: 'start' }}
|
|
40
|
+
gutter={24}
|
|
41
|
+
>
|
|
42
|
+
<OrCol>
|
|
43
|
+
<SVG width={72} height={48} src={props.flagSrc} />
|
|
44
|
+
</OrCol>
|
|
45
|
+
<OrCol xs={{ offset: 1 }}>
|
|
46
|
+
<AtText>{props.name}</AtText>
|
|
47
|
+
</OrCol>
|
|
48
|
+
</OrRow>
|
|
49
|
+
</MlCard>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
OrCountryCard.defaultProps = {
|
|
54
|
+
selected: false,
|
|
55
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { OrFlagGrid } from '.';
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Organisms/OrFlagGrid',
|
|
6
|
+
component: OrFlagGrid,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
} satisfies Meta<typeof OrFlagGrid>;
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
|
|
13
|
+
const CountriesExampleData = [
|
|
14
|
+
{
|
|
15
|
+
name: 'Venezuela',
|
|
16
|
+
flagSrc:
|
|
17
|
+
'https://upload.wikimedia.org/wikipedia/commons/0/06/Flag_of_Venezuela.svg',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'Colombia',
|
|
21
|
+
flagSrc:
|
|
22
|
+
'https://upload.wikimedia.org/wikipedia/commons/2/21/Flag_of_Colombia.svg',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'Mexico',
|
|
26
|
+
flagSrc:
|
|
27
|
+
'https://upload.wikimedia.org/wikipedia/commons/f/fc/Flag_of_Mexico.svg',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'Peru',
|
|
31
|
+
flagSrc:
|
|
32
|
+
'https://upload.wikimedia.org/wikipedia/commons/c/cf/Flag_of_Peru.svg',
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
export const Basic: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
id: '1',
|
|
39
|
+
data: CountriesExampleData,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { OrCountryCardProps, OrCountryCard } from '../OrCountryCard';
|
|
3
|
+
import { Row, Col } from 'antd';
|
|
4
|
+
|
|
5
|
+
export interface OrFlagGridProps {
|
|
6
|
+
/**
|
|
7
|
+
* The ID for cards
|
|
8
|
+
*/
|
|
9
|
+
id?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Country data to show elements into the grid
|
|
12
|
+
*/
|
|
13
|
+
data?: OrCountryCardProps[];
|
|
14
|
+
/**
|
|
15
|
+
* Number of items that can contain a row
|
|
16
|
+
*/
|
|
17
|
+
itemsPerRow?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Index selected Item
|
|
20
|
+
*/
|
|
21
|
+
selectedItem?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Callback when card is clicked
|
|
24
|
+
*/
|
|
25
|
+
onSelectCard?: (index: number) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const OrFlagGrid: React.FC<OrFlagGridProps> = ({
|
|
29
|
+
data,
|
|
30
|
+
itemsPerRow,
|
|
31
|
+
selectedItem,
|
|
32
|
+
onSelectCard,
|
|
33
|
+
}) => {
|
|
34
|
+
const span = useMemo(() => 24 / (itemsPerRow ?? 1), [itemsPerRow]);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Row gutter={[16, 16]} justify={'center'}>
|
|
38
|
+
{data?.map((item, i) => (
|
|
39
|
+
<Col key={i} xs={{ span: 24 }} md={{ span }}>
|
|
40
|
+
<OrCountryCard
|
|
41
|
+
selected={selectedItem === i}
|
|
42
|
+
onClick={() => onSelectCard?.(i)}
|
|
43
|
+
{...item}
|
|
44
|
+
/>
|
|
45
|
+
</Col>
|
|
46
|
+
))}
|
|
47
|
+
</Row>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
OrFlagGrid.defaultProps = {
|
|
52
|
+
data: [],
|
|
53
|
+
itemsPerRow: 2,
|
|
54
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Form, FormProps } from 'antd';
|
|
3
|
+
|
|
4
|
+
export type OrFromProps = FormProps & {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const OrForm: React.FC<OrFromProps> = ({ children, ...props }) => {
|
|
9
|
+
return <Form {...props}>{children}</Form>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { OrLoginLayout } from '.';
|
|
4
|
+
import defaultBackground from '../../assets/backgrounds/bg-1.png';
|
|
5
|
+
import defaultCarouselImage from '../../assets/carousel/login/1st.png';
|
|
6
|
+
import { OrRow } from '../OrRow';
|
|
7
|
+
import { AtTitle } from '../../atoms';
|
|
8
|
+
|
|
9
|
+
const meta = {
|
|
10
|
+
title: 'Organisms/OrLoginLayout',
|
|
11
|
+
component: OrLoginLayout,
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
} satisfies Meta<typeof OrLoginLayout>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
|
|
18
|
+
export const Basic: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
carouselImages: [
|
|
21
|
+
defaultCarouselImage,
|
|
22
|
+
defaultCarouselImage,
|
|
23
|
+
defaultCarouselImage,
|
|
24
|
+
],
|
|
25
|
+
$carouselBackgroundSrc: defaultBackground,
|
|
26
|
+
},
|
|
27
|
+
render: (args) => (
|
|
28
|
+
<OrLoginLayout {...args}>
|
|
29
|
+
<OrRow justify={'space-between'} align={'middle'}>
|
|
30
|
+
<AtTitle>Content</AtTitle>
|
|
31
|
+
</OrRow>
|
|
32
|
+
</OrLoginLayout>
|
|
33
|
+
),
|
|
34
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyledCarouselImageContainer, StyledContainer } from './styles';
|
|
3
|
+
import { OrRow } from '../OrRow';
|
|
4
|
+
import { OrCol } from '../OrCol';
|
|
5
|
+
import { MlCarousel } from '../../molecules';
|
|
6
|
+
import { AtImage } from '../../atoms';
|
|
7
|
+
|
|
8
|
+
export interface OrLoginLayoutProps {
|
|
9
|
+
/**
|
|
10
|
+
* Carousel image background source
|
|
11
|
+
*/
|
|
12
|
+
$carouselBackgroundSrc?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Images to show into carousel
|
|
15
|
+
*/
|
|
16
|
+
carouselImages: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Content to render into layout
|
|
19
|
+
*/
|
|
20
|
+
children?: React.ReactElement;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const OrLoginLayout: React.FC<OrLoginLayoutProps> = ({
|
|
24
|
+
$carouselBackgroundSrc,
|
|
25
|
+
carouselImages,
|
|
26
|
+
children,
|
|
27
|
+
}) => {
|
|
28
|
+
return (
|
|
29
|
+
<StyledContainer>
|
|
30
|
+
<OrRow align="stretch" justify="center">
|
|
31
|
+
<OrCol
|
|
32
|
+
$justify="start"
|
|
33
|
+
xs={{ span: 24, $paddingHorizontal: 20, $paddingTop: 40 }}
|
|
34
|
+
md={{ span: 14, $paddingHorizontal: 64, $paddingTop: 120 }}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
</OrCol>
|
|
38
|
+
|
|
39
|
+
<OrCol
|
|
40
|
+
xs={{ hidden: true }}
|
|
41
|
+
md={{ span: 10 }}
|
|
42
|
+
$justify="center"
|
|
43
|
+
$backgroundSrc={$carouselBackgroundSrc}
|
|
44
|
+
>
|
|
45
|
+
<MlCarousel
|
|
46
|
+
dots={true}
|
|
47
|
+
autoplay={true}
|
|
48
|
+
waitForAnimate={true}
|
|
49
|
+
dotPosition="bottom"
|
|
50
|
+
>
|
|
51
|
+
{carouselImages.map((elem, key) => (
|
|
52
|
+
<div key={key}>
|
|
53
|
+
<StyledCarouselImageContainer>
|
|
54
|
+
<AtImage src={elem} preview={false} alt="Test image" />
|
|
55
|
+
</StyledCarouselImageContainer>
|
|
56
|
+
</div>
|
|
57
|
+
))}
|
|
58
|
+
</MlCarousel>
|
|
59
|
+
</OrCol>
|
|
60
|
+
</OrRow>
|
|
61
|
+
</StyledContainer>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import { styled } from 'styled-components';
|
|
3
|
+
import { gray } from '../../../theme';
|
|
4
|
+
|
|
5
|
+
export const StyledContainer = styled.div`
|
|
6
|
+
& {
|
|
7
|
+
display: flex;
|
|
8
|
+
background-color: ${gray[1]};
|
|
9
|
+
height: 100vh;
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export const StyledCarouselImageContainer = styled.div`
|
|
15
|
+
text-align: center;
|
|
16
|
+
`;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { OrRow } from '.';
|
|
3
|
+
import { AtButton } from '../../atoms/AtButton';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Organisms/OrRow',
|
|
8
|
+
component: OrRow,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
align: { options: ['start', 'end', 'center', 'baseline'] },
|
|
12
|
+
justify: {
|
|
13
|
+
options: [
|
|
14
|
+
'start',
|
|
15
|
+
'end',
|
|
16
|
+
'center',
|
|
17
|
+
'space-around',
|
|
18
|
+
'space-between',
|
|
19
|
+
'space-evenly',
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
gutter: {
|
|
23
|
+
control: 'number',
|
|
24
|
+
},
|
|
25
|
+
children: {
|
|
26
|
+
control: 'none',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
} satisfies Meta<typeof OrRow>;
|
|
30
|
+
|
|
31
|
+
export default meta;
|
|
32
|
+
|
|
33
|
+
type Story = StoryObj<typeof meta>;
|
|
34
|
+
|
|
35
|
+
export const Basic: Story = {
|
|
36
|
+
args: {
|
|
37
|
+
id: '1',
|
|
38
|
+
},
|
|
39
|
+
render: (args) => {
|
|
40
|
+
return (
|
|
41
|
+
<OrRow {...args}>
|
|
42
|
+
{new Array(5).fill(null).map((_, index) => (
|
|
43
|
+
<AtButton key={index} value={`AtButton-${index}`} />
|
|
44
|
+
))}
|
|
45
|
+
</OrRow>
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
};
|