w-design-system 0.0.21 → 0.0.22
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/assets/icon/chevron-down.svg +3 -0
- package/dist/assets/icon/chevron-left.svg +3 -0
- package/dist/assets/icon/chevron-right.svg +3 -0
- package/dist/assets/icon/dump.svg +3 -0
- package/dist/assets/icon/edit.svg +10 -0
- package/dist/assets/icon/index.d.ts +6 -1
- package/dist/assets/icon/index.d.ts.map +1 -1
- package/dist/assets/icon/index.js +6 -1
- package/dist/assets/icon/index.js.map +1 -1
- package/dist/assets/icon/index.ts +17 -1
- package/dist/assets/icon/spin.svg +3 -0
- package/dist/components/ButtonRound/index.d.ts.map +1 -1
- package/dist/components/ButtonRound/index.js +4 -4
- package/dist/components/ButtonRound/index.js.map +1 -1
- package/dist/components/ButtonRound/stories.d.ts.map +1 -1
- package/dist/components/ButtonRound/stories.js +1 -2
- package/dist/components/ButtonRound/stories.js.map +1 -1
- package/dist/components/ButtonRound/styles.js +5 -5
- package/dist/components/ButtonRound/styles.js.map +1 -1
- package/dist/components/CardStories/index.d.ts +9 -0
- package/dist/components/CardStories/index.d.ts.map +1 -0
- package/dist/components/CardStories/index.js +43 -0
- package/dist/components/CardStories/index.js.map +1 -0
- package/dist/components/CardStories/stories.d.ts +9 -0
- package/dist/components/CardStories/stories.d.ts.map +1 -0
- package/dist/components/CardStories/stories.js +35 -0
- package/dist/components/CardStories/stories.js.map +1 -0
- package/dist/components/Loading/index.d.ts +8 -0
- package/dist/components/Loading/index.d.ts.map +1 -0
- package/dist/components/Loading/index.js +50 -0
- package/dist/components/Loading/index.js.map +1 -0
- package/dist/components/Loading/stories.d.ts +12 -0
- package/dist/components/Loading/stories.d.ts.map +1 -0
- package/dist/components/Loading/stories.js +46 -0
- package/dist/components/Loading/stories.js.map +1 -0
- package/dist/components/Paginate/index.d.ts +10 -0
- package/dist/components/Paginate/index.d.ts.map +1 -0
- package/dist/components/Paginate/index.js +58 -0
- package/dist/components/Paginate/index.js.map +1 -0
- package/dist/components/Paginate/stories.d.ts +6 -0
- package/dist/components/Paginate/stories.d.ts.map +1 -0
- package/dist/components/Paginate/stories.js +37 -0
- package/dist/components/Paginate/stories.js.map +1 -0
- package/dist/components/Paginate/styles.d.ts +2 -0
- package/dist/components/Paginate/styles.d.ts.map +1 -0
- package/dist/components/Paginate/styles.js +97 -0
- package/dist/components/Paginate/styles.js.map +1 -0
- package/dist/components/Paragraph/index.d.ts +1 -0
- package/dist/components/Paragraph/index.d.ts.map +1 -1
- package/dist/components/Paragraph/index.js +4 -3
- package/dist/components/Paragraph/index.js.map +1 -1
- package/dist/components/Table/index.d.ts +21 -0
- package/dist/components/Table/index.d.ts.map +1 -0
- package/dist/components/Table/index.js +90 -0
- package/dist/components/Table/index.js.map +1 -0
- package/dist/components/Table/stories.d.ts +9 -0
- package/dist/components/Table/stories.d.ts.map +1 -0
- package/dist/components/Table/stories.js +159 -0
- package/dist/components/Table/stories.js.map +1 -0
- package/dist/components/Table/styles.d.ts +1 -0
- package/dist/components/Table/styles.d.ts.map +1 -0
- package/dist/components/Table/styles.js +2 -0
- package/dist/components/Table/styles.js.map +1 -0
- package/dist/components/Types/index.d.ts +1 -0
- package/dist/components/Types/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/icon/chevron-down.svg +3 -0
- package/src/assets/icon/chevron-left.svg +3 -0
- package/src/assets/icon/chevron-right.svg +3 -0
- package/src/assets/icon/dump.svg +3 -0
- package/src/assets/icon/edit.svg +10 -0
- package/src/assets/icon/index.ts +17 -1
- package/src/assets/icon/spin.svg +3 -0
- package/src/components/ButtonRound/index.tsx +5 -4
- package/src/components/ButtonRound/stories.tsx +2 -2
- package/src/components/ButtonRound/styles.ts +5 -5
- package/src/components/CardStories/index.tsx +59 -0
- package/src/components/CardStories/stories.tsx +44 -0
- package/src/components/Loading/index.tsx +73 -0
- package/src/components/Loading/stories.tsx +65 -0
- package/src/components/Paginate/index.tsx +108 -0
- package/src/components/Paginate/stories.tsx +53 -0
- package/src/components/Paginate/styles.ts +96 -0
- package/src/components/Paragraph/index.tsx +13 -4
- package/src/components/Table/index.tsx +203 -0
- package/src/components/Table/stories.tsx +198 -0
- package/src/components/Table/styles.ts +0 -0
- package/src/components/Types/index.ts +1 -0
- package/src/components/index.tsx +2 -0
|
@@ -98,8 +98,8 @@ export const ButtonStyled = styled.button<ButtonRoundTypes>`
|
|
|
98
98
|
align-items: center;
|
|
99
99
|
justify-content: center;
|
|
100
100
|
box-sizing: border-box;
|
|
101
|
-
height:
|
|
102
|
-
width:
|
|
101
|
+
height: ${({ size }) => (size === 'small' ? '32px' : '40px')};
|
|
102
|
+
width: ${({ size }) => (size === 'small' ? '32px' : '40px')};
|
|
103
103
|
font-size: 16px;
|
|
104
104
|
font-weight: 600;
|
|
105
105
|
line-height: 140%;
|
|
@@ -111,7 +111,7 @@ export const ButtonStyled = styled.button<ButtonRoundTypes>`
|
|
|
111
111
|
background-color 0.3s,
|
|
112
112
|
opacity 0.3s;
|
|
113
113
|
color: white;
|
|
114
|
-
gap: 12px;
|
|
114
|
+
gap: ${({ size }) => (size === 'small' ? '8' : '12px')};
|
|
115
115
|
cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
|
|
116
116
|
opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};
|
|
117
117
|
${({ variant = 'primary', outline }) => colorScheme[variant]};
|
|
@@ -124,8 +124,8 @@ export const ButtonStyled = styled.button<ButtonRoundTypes>`
|
|
|
124
124
|
margin-bottom: 24px;
|
|
125
125
|
margin-left: 54px;
|
|
126
126
|
position: absolute;
|
|
127
|
-
width: 26px;
|
|
128
|
-
height: 26px;
|
|
127
|
+
width: ${({ size }) => (size === 'small' ? '16px' : '26px')};
|
|
128
|
+
height: ${({ size }) => (size === 'small' ? '16px' : '26px')};
|
|
129
129
|
border-radius: 100%;
|
|
130
130
|
font-size: 12px;
|
|
131
131
|
display: flex;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import styled, { keyframes } from 'styled-components'
|
|
3
|
+
import { Paragraph } from '../Paragraph'
|
|
4
|
+
import { theme } from '../Themes'
|
|
5
|
+
|
|
6
|
+
const ContainerCardStories = styled.div`
|
|
7
|
+
min-height: 300px;
|
|
8
|
+
min-width: 200px;
|
|
9
|
+
height: auto;
|
|
10
|
+
width: auto;
|
|
11
|
+
border: 1px solid #e0e0e0;
|
|
12
|
+
border-radius: 8px;
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
`
|
|
17
|
+
|
|
18
|
+
const Wrapper = styled.div`
|
|
19
|
+
padding: 16px;
|
|
20
|
+
display: flex;
|
|
21
|
+
min-height: 240px;
|
|
22
|
+
min-width: 200px;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
align-items: center;
|
|
25
|
+
flex-wrap: wrap;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
`
|
|
28
|
+
const WrapperFooter = styled.div`
|
|
29
|
+
height: 50px;
|
|
30
|
+
width: 100%;
|
|
31
|
+
display: flex;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
align-items: center;
|
|
34
|
+
border-top: 1px solid #e0e0e0;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
`
|
|
37
|
+
|
|
38
|
+
interface CardStoriesProps {
|
|
39
|
+
title?: string
|
|
40
|
+
subTitle?: string
|
|
41
|
+
children?: React.ReactNode
|
|
42
|
+
}
|
|
43
|
+
const CardStories = ({ title, subTitle, children }: CardStoriesProps) => {
|
|
44
|
+
return (
|
|
45
|
+
<ContainerCardStories>
|
|
46
|
+
<Wrapper>{children}</Wrapper>
|
|
47
|
+
<WrapperFooter>
|
|
48
|
+
<Paragraph color={theme.colors.shade50} weight={800}>
|
|
49
|
+
{title}
|
|
50
|
+
</Paragraph>
|
|
51
|
+
<Paragraph size={'x-small'} color={theme.colors.shade30}>
|
|
52
|
+
{subTitle}
|
|
53
|
+
</Paragraph>
|
|
54
|
+
</WrapperFooter>
|
|
55
|
+
</ContainerCardStories>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default CardStories
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import CardStories from './index'
|
|
3
|
+
import { Paragraph } from '../Paragraph'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof CardStories> = {
|
|
7
|
+
title: 'Components/CardStories',
|
|
8
|
+
component: CardStories,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
},
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
} satisfies Meta<typeof CardStories>
|
|
14
|
+
|
|
15
|
+
export default meta
|
|
16
|
+
type Story = StoryObj<typeof meta>
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
title: 'Default Title',
|
|
21
|
+
subTitle: 'Default Subtitle',
|
|
22
|
+
children: 'This is the default content.',
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const WithCustomContent: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
title: 'Custom Title',
|
|
29
|
+
subTitle: 'Custom Subtitle',
|
|
30
|
+
children: (
|
|
31
|
+
<>
|
|
32
|
+
<Paragraph>This is custom content.</Paragraph>
|
|
33
|
+
<Paragraph size="small">Additional custom content.</Paragraph>
|
|
34
|
+
</>
|
|
35
|
+
),
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const WithoutSubtitle: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
title: 'Title Only',
|
|
42
|
+
children: <Paragraph>This card has no subtitle.</Paragraph>,
|
|
43
|
+
},
|
|
44
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import styled, { keyframes } from 'styled-components'
|
|
3
|
+
import spinSVG from '../../assets/icon/spin.svg'
|
|
4
|
+
import { Paragraph } from '../Paragraph'
|
|
5
|
+
import { theme } from '../Themes'
|
|
6
|
+
|
|
7
|
+
// Animação de rotação
|
|
8
|
+
const spinAnimation = keyframes`
|
|
9
|
+
0% { transform: rotate(0deg); }
|
|
10
|
+
100% { transform: rotate(360deg); }
|
|
11
|
+
`
|
|
12
|
+
|
|
13
|
+
// Estilos para o wrapper de tela cheia
|
|
14
|
+
const FullScreenWrapper = styled.div`
|
|
15
|
+
position: fixed;
|
|
16
|
+
top: 0;
|
|
17
|
+
left: 0;
|
|
18
|
+
width: 100vw;
|
|
19
|
+
height: 100vh;
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
background-color: rgb(164, 162, 162);
|
|
24
|
+
z-index: 9999;
|
|
25
|
+
`
|
|
26
|
+
|
|
27
|
+
// Estilos para o wrapper do contêiner
|
|
28
|
+
const ContainerWrapper = styled.div``
|
|
29
|
+
|
|
30
|
+
// Estilos para o wrapper do conteúdo
|
|
31
|
+
const ContainerWrapperStyles = styled.div`
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
gap: 16px;
|
|
37
|
+
`
|
|
38
|
+
|
|
39
|
+
// Estilos para a imagem de loading
|
|
40
|
+
const LoadingImage = styled.img<{ size: 'small' | 'medium' | 'large' }>`
|
|
41
|
+
width: ${({ size }) => (size === 'small' ? '30px' : size === 'medium' ? '50px' : '70px')};
|
|
42
|
+
height: ${({ size }) => (size === 'small' ? '30px' : size === 'medium' ? '50px' : '70px')};
|
|
43
|
+
animation: ${spinAnimation} 2s linear infinite;
|
|
44
|
+
`
|
|
45
|
+
|
|
46
|
+
// Tipagem para as props de loading
|
|
47
|
+
interface LoadingProps {
|
|
48
|
+
size?: 'small' | 'medium' | 'large'
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Componente de loading em tela cheia
|
|
52
|
+
export const FullScreenLoading: React.FC<LoadingProps> = ({ size = 'medium' }) => (
|
|
53
|
+
<FullScreenWrapper>
|
|
54
|
+
<ContainerWrapperStyles>
|
|
55
|
+
<LoadingImage src={spinSVG} alt="loading" size={size} />
|
|
56
|
+
<Paragraph color={theme.colors.shade40} size="x-small">
|
|
57
|
+
CARREGANDO
|
|
58
|
+
</Paragraph>
|
|
59
|
+
</ContainerWrapperStyles>
|
|
60
|
+
</FullScreenWrapper>
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
// Componente de loading no contêiner
|
|
64
|
+
export const ContainerLoading: React.FC<LoadingProps> = ({ size = 'medium' }) => (
|
|
65
|
+
<ContainerWrapper>
|
|
66
|
+
<ContainerWrapperStyles>
|
|
67
|
+
<LoadingImage src={spinSVG} alt="loading" size={size} />
|
|
68
|
+
<Paragraph color={theme.colors.shade30} size="x-small">
|
|
69
|
+
CARREGANDO
|
|
70
|
+
</Paragraph>
|
|
71
|
+
</ContainerWrapperStyles>
|
|
72
|
+
</ContainerWrapper>
|
|
73
|
+
)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// src/components/Loading/stories.tsx
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import { FullScreenLoading, ContainerLoading } from './index'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
import CardStories from '../CardStories'
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof FullScreenLoading> = {
|
|
8
|
+
title: 'Components/Loading',
|
|
9
|
+
component: FullScreenLoading,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
},
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
argTypes: {
|
|
15
|
+
size: {
|
|
16
|
+
control: { type: 'select', options: ['small', 'medium', 'large'] },
|
|
17
|
+
description: 'Select the size of the loading spinner',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
} satisfies Meta<typeof FullScreenLoading>
|
|
21
|
+
|
|
22
|
+
export default meta
|
|
23
|
+
type Story = StoryObj<typeof meta>
|
|
24
|
+
|
|
25
|
+
export const FullScreenSmall: Story = {
|
|
26
|
+
args: {
|
|
27
|
+
size: 'small',
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const FullScreenMedium: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
size: 'medium',
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const FullScreenLarge: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
size: 'large',
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const ContainerSmall: Story = {
|
|
44
|
+
render: () => (
|
|
45
|
+
<CardStories title="Loading" subTitle="small">
|
|
46
|
+
<ContainerLoading size="small" />
|
|
47
|
+
</CardStories>
|
|
48
|
+
),
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const ContainerMedium: Story = {
|
|
52
|
+
render: () => (
|
|
53
|
+
<CardStories title="Loading" subTitle="medium">
|
|
54
|
+
<ContainerLoading size="medium" />
|
|
55
|
+
</CardStories>
|
|
56
|
+
),
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const ContainerLarge: Story = {
|
|
60
|
+
render: () => (
|
|
61
|
+
<CardStories title="Loading" subTitle="large">
|
|
62
|
+
<ContainerLoading size="large" />
|
|
63
|
+
</CardStories>
|
|
64
|
+
),
|
|
65
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Container } from './styles'
|
|
3
|
+
import { IconWrapper } from '../IconWrapper'
|
|
4
|
+
import { chevronLeftSVG, chevronRightSVG } from '../../assets/icon'
|
|
5
|
+
export type PropsPaginate = {
|
|
6
|
+
currentPage: number
|
|
7
|
+
itemCount: number
|
|
8
|
+
itemsPerPage?: number
|
|
9
|
+
onChangePage: (page: number) => void
|
|
10
|
+
onChangeItemsPerPage: (itemsPerPage: number) => void
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const Paginate = ({
|
|
14
|
+
currentPage,
|
|
15
|
+
itemCount,
|
|
16
|
+
onChangePage,
|
|
17
|
+
itemsPerPage,
|
|
18
|
+
onChangeItemsPerPage,
|
|
19
|
+
}: PropsPaginate) => {
|
|
20
|
+
// Se itemsPerPage for undefined, o valor default e 20
|
|
21
|
+
let itemsPerPageValue = itemsPerPage || 20
|
|
22
|
+
|
|
23
|
+
const pageCount = Math.ceil(itemCount / itemsPerPageValue)
|
|
24
|
+
|
|
25
|
+
const pages: (number | 'elipsis')[] = []
|
|
26
|
+
|
|
27
|
+
// o interval indica quantas paginas mostrar antes e depois da pagina atual
|
|
28
|
+
const interval = 2
|
|
29
|
+
|
|
30
|
+
// Adiciona a primeira pagina
|
|
31
|
+
if (pageCount > 0 && currentPage - interval > 1) {
|
|
32
|
+
pages.push(1)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Adiciona as paginas entre a primeira e a ultima do intervalo
|
|
36
|
+
const start = Math.max(currentPage - interval, 1)
|
|
37
|
+
const end = Math.min(currentPage + interval, pageCount)
|
|
38
|
+
|
|
39
|
+
if (start > 2) {
|
|
40
|
+
pages.push('elipsis')
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
for (let i = start; i <= end; i++) {
|
|
44
|
+
pages.push(i)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (end < pageCount - 1) {
|
|
48
|
+
pages.push('elipsis')
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (pageCount > currentPage + interval) {
|
|
52
|
+
pages.push(pageCount)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const minItem = (currentPage - 1) * itemsPerPageValue + 1
|
|
56
|
+
const maxItem = Math.min(currentPage * itemsPerPageValue, itemCount)
|
|
57
|
+
|
|
58
|
+
const itemPerPageOptions = Array.from(new Set([10, 20, 50, 100, itemsPerPage]))
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Container>
|
|
62
|
+
<ul className="pagination">
|
|
63
|
+
<IconWrapper
|
|
64
|
+
className={currentPage === 1 ? 'icon-disabled' : 'icon'}
|
|
65
|
+
src={chevronLeftSVG}
|
|
66
|
+
width="14px"
|
|
67
|
+
onClick={() => onChangePage(currentPage - 1)}
|
|
68
|
+
/>
|
|
69
|
+
{pages.map((page, index) => {
|
|
70
|
+
if (page === 'elipsis') {
|
|
71
|
+
return <li key={`elipsis-${index}`}>...</li>
|
|
72
|
+
}
|
|
73
|
+
return (
|
|
74
|
+
<li key={page} className={page === currentPage ? 'page-active' : 'page'} onClick={() => onChangePage(page)}>
|
|
75
|
+
{page}
|
|
76
|
+
</li>
|
|
77
|
+
)
|
|
78
|
+
})}
|
|
79
|
+
<IconWrapper
|
|
80
|
+
className={currentPage === pageCount ? 'icon-disabled' : 'icon'}
|
|
81
|
+
src={chevronRightSVG}
|
|
82
|
+
width="14px"
|
|
83
|
+
onClick={() => onChangePage(currentPage + 1)}
|
|
84
|
+
/>
|
|
85
|
+
</ul>
|
|
86
|
+
<div className="items-per-page-wrapper">
|
|
87
|
+
<div className="item-per-page">Itens por página</div>
|
|
88
|
+
<select
|
|
89
|
+
value={itemsPerPageValue}
|
|
90
|
+
onChange={e => {
|
|
91
|
+
onChangeItemsPerPage(Number(e.target.value))
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
{itemPerPageOptions.map((item, index) => {
|
|
95
|
+
return (
|
|
96
|
+
<option key={index} value={item}>
|
|
97
|
+
{item}
|
|
98
|
+
</option>
|
|
99
|
+
)
|
|
100
|
+
})}
|
|
101
|
+
</select>
|
|
102
|
+
<div className="items-per-page-selected">
|
|
103
|
+
{minItem} - {maxItem} de {itemCount}
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
</Container>
|
|
107
|
+
)
|
|
108
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import React, { useState } from 'react'
|
|
3
|
+
|
|
4
|
+
import { action } from '@storybook/addon-actions'
|
|
5
|
+
import { fn } from '@storybook/test'
|
|
6
|
+
import { Paginate, PropsPaginate } from '.'
|
|
7
|
+
|
|
8
|
+
const meta: Meta<PropsPaginate> = {
|
|
9
|
+
title: 'Components/Paginate',
|
|
10
|
+
component: Paginate,
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
args: {
|
|
13
|
+
currentPage: 1,
|
|
14
|
+
itemCount: 100,
|
|
15
|
+
itemsPerPage: 10,
|
|
16
|
+
onChangePage: fn(),
|
|
17
|
+
onChangeItemsPerPage: fn(),
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default meta
|
|
22
|
+
|
|
23
|
+
const NewPaginate = (args: PropsPaginate) => {
|
|
24
|
+
const [currentPage, setCurrentPage] = useState(args.currentPage)
|
|
25
|
+
const [itemCount, setItemCount] = useState(args.itemCount)
|
|
26
|
+
const [itemsPerPage, setItemsPerPage] = useState(args.itemsPerPage)
|
|
27
|
+
|
|
28
|
+
const handleChangePage = (page: number) => {
|
|
29
|
+
setCurrentPage(page)
|
|
30
|
+
action('changePage')(page)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const handleChangeItemsPerPage = (items: number) => {
|
|
34
|
+
setItemsPerPage(items)
|
|
35
|
+
action('changeItemsPerPage')(items)
|
|
36
|
+
}
|
|
37
|
+
return (
|
|
38
|
+
<Paginate
|
|
39
|
+
{...args}
|
|
40
|
+
currentPage={currentPage}
|
|
41
|
+
itemCount={itemCount}
|
|
42
|
+
itemsPerPage={itemsPerPage}
|
|
43
|
+
onChangePage={handleChangePage}
|
|
44
|
+
onChangeItemsPerPage={handleChangeItemsPerPage}
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const Default: StoryObj<PropsPaginate> = {
|
|
50
|
+
render: args => {
|
|
51
|
+
return <NewPaginate {...args} />
|
|
52
|
+
},
|
|
53
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import styled from 'styled-components'
|
|
2
|
+
import { theme } from '../Themes'
|
|
3
|
+
import { chevronDownSVG } from '../../assets/icon'
|
|
4
|
+
export const Container = styled.div`
|
|
5
|
+
display: flex;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
align-items: center;
|
|
8
|
+
|
|
9
|
+
.icon,
|
|
10
|
+
.icon svg,
|
|
11
|
+
.icon svg path {
|
|
12
|
+
fill: ${theme.colors.shade30} !important;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.icon:hover,
|
|
16
|
+
.icon:hover svg,
|
|
17
|
+
.icon:hover svg path {
|
|
18
|
+
fill: ${theme.colors.cyan30} !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.icon-disabled,
|
|
22
|
+
.icon-disabled svg,
|
|
23
|
+
.icon-disabled svg path {
|
|
24
|
+
fill: ${theme.colors.shade20} !important;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ul.pagination {
|
|
28
|
+
display: flex;
|
|
29
|
+
gap: 1rem;
|
|
30
|
+
font-family: 'Nunito Sans', sans-serif;
|
|
31
|
+
font-size: 1rem;
|
|
32
|
+
color: ${theme.colors.shade40};
|
|
33
|
+
li {
|
|
34
|
+
list-style: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
li.page {
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
li.page:hover {
|
|
42
|
+
color: ${theme.colors.cyan30};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
li.page-active {
|
|
46
|
+
color: ${theme.colors.cyan30};
|
|
47
|
+
cursor: default;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.items-per-page-wrapper {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
|
|
55
|
+
gap: 1rem;
|
|
56
|
+
font-family: 'Nunito Sans', sans-serif;
|
|
57
|
+
color: ${theme.colors.shade40};
|
|
58
|
+
|
|
59
|
+
select {
|
|
60
|
+
/* styling */
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
background-color: ${theme.colors.shade05};
|
|
63
|
+
background-image: url(${chevronDownSVG});
|
|
64
|
+
background-repeat: no-repeat;
|
|
65
|
+
background-size: 1rem;
|
|
66
|
+
background-position: right 1rem top calc(50% + 1px);
|
|
67
|
+
border: 1px solid ${theme.colors.shade20};
|
|
68
|
+
color: ${theme.colors.shade40};
|
|
69
|
+
border-radius: 4px;
|
|
70
|
+
display: inline-block;
|
|
71
|
+
font: inherit;
|
|
72
|
+
outline: 0;
|
|
73
|
+
|
|
74
|
+
padding: 18px 48px 14px 16px;
|
|
75
|
+
|
|
76
|
+
margin: 0;
|
|
77
|
+
-webkit-box-sizing: border-box;
|
|
78
|
+
-moz-box-sizing: border-box;
|
|
79
|
+
box-sizing: border-box;
|
|
80
|
+
-webkit-appearance: none;
|
|
81
|
+
-moz-appearance: none; /* Firefox */
|
|
82
|
+
-webkit-appearance: none; /* Safari and Chrome */
|
|
83
|
+
appearance: none;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
select:hover {
|
|
87
|
+
background-color: ${theme.colors.shade10};
|
|
88
|
+
border: 1px solid ${theme.colors.shade20};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
select:focus {
|
|
92
|
+
background-color: ${theme.colors.shade10};
|
|
93
|
+
border: 1px solid ${theme.colors.shade30};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
`
|
|
@@ -5,7 +5,8 @@ interface ParagraphProps {
|
|
|
5
5
|
size?: 'x-small' | 'small' | 'medium' | 'large'
|
|
6
6
|
weight?: 400 | 600 | 700 | 800
|
|
7
7
|
as?: 'span' | 'div' | 'label' | 'p'
|
|
8
|
-
color?: string
|
|
8
|
+
color?: string
|
|
9
|
+
textTransform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase' // Adicionando a propriedade textTransform
|
|
9
10
|
children: React.ReactNode
|
|
10
11
|
}
|
|
11
12
|
|
|
@@ -30,12 +31,20 @@ const ParagraphStyled = styled.p<ParagraphProps>`
|
|
|
30
31
|
font-weight: ${props => (props.weight ? weights[props.weight] : 400)};
|
|
31
32
|
line-height: 140%;
|
|
32
33
|
font-family: 'Nunito Sans', sans-serif;
|
|
33
|
-
color: ${props => props.color || 'inherit'};
|
|
34
|
+
color: ${props => props.color || 'inherit'};
|
|
35
|
+
text-transform: ${props => props.textTransform || 'none'}; // Aplicando textTransform
|
|
34
36
|
`
|
|
35
37
|
|
|
36
|
-
export const Paragraph: React.FC<ParagraphProps> = ({
|
|
38
|
+
export const Paragraph: React.FC<ParagraphProps> = ({
|
|
39
|
+
size = 'small',
|
|
40
|
+
weight,
|
|
41
|
+
as = 'p',
|
|
42
|
+
color,
|
|
43
|
+
textTransform,
|
|
44
|
+
children,
|
|
45
|
+
}) => {
|
|
37
46
|
return (
|
|
38
|
-
<ParagraphStyled as={as} size={size} weight={weight} color={color}>
|
|
47
|
+
<ParagraphStyled as={as} size={size} weight={weight} color={color} textTransform={textTransform}>
|
|
39
48
|
{children}
|
|
40
49
|
</ParagraphStyled>
|
|
41
50
|
)
|