Skip to content

Commit 7bb082f

Browse files
committed
feat(react): ✨ Criado componentes e stories base
Criado os componentes base em react e seus stories, tambem realizado a retirada temporaria das referencias de angular
1 parent 7864272 commit 7bb082f

File tree

98 files changed

+9193
-23629
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+9193
-23629
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"conventionalCommits.scopes": ["tree"]
2+
"conventionalCommits.scopes": ["tree", "react"]
33
}

applications/react/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
"typescript": "^5.4.5"
2525
},
2626
"dependencies": {
27-
"@stitches/react": "^1.2.8"
27+
"@stitches/react": "^1.2.8",
28+
"@radix-ui/react-avatar": "^1.0.4",
29+
"@radix-ui/react-checkbox": "^1.0.0",
30+
"phosphor-react": "^1.4.1"
2831
}
2932
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { User } from "phosphor-react";
2+
import { AvatarContainer, AvatarImage, AvatarFallback } from "./styles";
3+
import { AvatarProps } from "../../types/AvatarProps";
4+
5+
export function Avatar(props: AvatarProps) {
6+
return (
7+
<AvatarContainer>
8+
<AvatarImage {...props} />
9+
10+
<AvatarFallback delayMs={600}>
11+
<User />
12+
</AvatarFallback>
13+
</AvatarContainer>
14+
);
15+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import * as Avatar from "@radix-ui/react-avatar";
2+
import { styled } from "../../styles";
3+
4+
export const AvatarContainer = styled(Avatar.Root, {
5+
borderRadius: "$full",
6+
display: "inline-block",
7+
width: "$12",
8+
height: "$12",
9+
overflow: "hidden",
10+
});
11+
12+
export const AvatarImage = styled(Avatar.Image, {
13+
width: "100%",
14+
height: "100%",
15+
objectFit: "cover",
16+
borderRadius: "inherit",
17+
});
18+
19+
export const AvatarFallback = styled(Avatar.Fallback, {
20+
width: "100%",
21+
height: "100%",
22+
display: "flex",
23+
alignItems: "center",
24+
justifyContent: "center",
25+
backgroundColor: "$gray600",
26+
color: "$gray800",
27+
28+
svg: {
29+
width: "$6",
30+
height: "$6",
31+
},
32+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { styled } from "../styles";
2+
3+
export const Box = styled("div", {
4+
padding: "$4",
5+
borderRadius: "$md",
6+
backgroundColor: "$gray800",
7+
border: "1px solid $gray600",
8+
});
Lines changed: 73 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,88 @@
11
import { styled } from "../styles";
2-
import { ComponentProps } from "react";
32

43
export const Button = styled("button", {
5-
backgroundColor: "$gray900",
4+
all: "unset",
65
borderRadius: "$sm",
7-
border: 0,
8-
fontWeight: "$bold",
9-
color: "$white",
6+
fontSize: "$sm",
7+
fontWeight: "$medium",
8+
fontFamily: "$default",
9+
textAlign: "center",
10+
minWidth: 120,
11+
boxSizing: "border-box",
12+
padding: "0 $4",
13+
14+
display: "flex",
15+
alignItems: "center",
16+
justifyContent: "center",
17+
gap: "$2",
18+
19+
cursor: "pointer",
20+
21+
svg: {
22+
width: "$4",
23+
height: "$4",
24+
},
25+
26+
"&:disabled": {
27+
cursor: "not-allowed",
28+
},
1029

1130
variants: {
31+
variant: {
32+
primary: {
33+
color: "$white",
34+
background: "$green500",
35+
36+
"&:not(:disabled):hover": {
37+
background: "$green300",
38+
},
39+
40+
"&:disabled": {
41+
backgroundColor: "$gray200",
42+
},
43+
},
44+
45+
secondary: {
46+
color: "$green300",
47+
border: "2px solid $green500",
48+
49+
"&:not(:disabled):hover": {
50+
background: "$green300",
51+
color: "$white",
52+
},
53+
54+
"&:disabled": {
55+
color: "$gray200",
56+
borderColor: "$gray200",
57+
},
58+
},
59+
60+
tertiary: {
61+
color: "$gray100",
62+
63+
"&:not(:disabled):hover": {
64+
color: "$white",
65+
},
66+
67+
"&:disabled": {
68+
color: "$gray600",
69+
},
70+
},
71+
},
72+
1273
size: {
13-
small: {
14-
fontSize: 14,
15-
padding: "$2 $4",
74+
sm: {
75+
height: 38,
1676
},
17-
big: {
18-
fontSize: 16,
19-
padding: "$3 $6",
77+
78+
md: {
79+
height: 46,
2080
},
2181
},
2282
},
2383

2484
defaultVariants: {
25-
size: "small",
85+
variant: "primary",
86+
size: "md",
2687
},
2788
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Check } from "phosphor-react";
2+
import { CheckboxContainer, CheckboxIndicator } from "./styles";
3+
import { CheckboxProps } from "../../types/CheckboxProps";
4+
5+
export function Checkbox(props: CheckboxProps) {
6+
return (
7+
<CheckboxContainer {...props}>
8+
<CheckboxIndicator asChild>
9+
<Check weight="bold" />
10+
</CheckboxIndicator>
11+
</CheckboxContainer>
12+
);
13+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import * as Checkbox from "@radix-ui/react-checkbox";
2+
import { styled, keyframes } from "../../styles";
3+
4+
export const CheckboxContainer = styled(Checkbox.Root, {
5+
all: "unset",
6+
width: "$6",
7+
height: "$6",
8+
backgroundColor: "$gray900",
9+
borderRadius: "$xs",
10+
lineHeight: 0,
11+
cursor: "pointer",
12+
overflow: "hidden",
13+
boxSizing: "border-box",
14+
display: "flex",
15+
justifyContent: "center",
16+
alignItems: "center",
17+
border: "2px solid $gray900",
18+
19+
'&[data-state="checked"]': {
20+
backgroundColor: "$ignite300",
21+
},
22+
23+
"&:focus": {
24+
border: "2px solid $ignite300",
25+
},
26+
});
27+
28+
const slideIn = keyframes({
29+
from: {
30+
transform: "translateY(-100%)",
31+
},
32+
to: {
33+
transform: "translateY(0)",
34+
},
35+
});
36+
37+
const slideOut = keyframes({
38+
from: {
39+
transform: "translateY(0)",
40+
},
41+
to: {
42+
transform: "translateY(-100%)",
43+
},
44+
});
45+
46+
export const CheckboxIndicator = styled(Checkbox.Indicator, {
47+
color: "$white",
48+
width: "$4",
49+
height: "$4",
50+
51+
'&[data-state="checked"]': {
52+
animation: `${slideIn} 200ms ease-out`,
53+
},
54+
55+
'&[data-state="unchecked"]': {
56+
animation: `${slideOut} 200ms ease-out`,
57+
},
58+
});
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { fontSizes } from "@saturn/pack-tokens";
2+
import { styled } from "../styles";
3+
4+
export const Heading = styled("h2", {
5+
fontFamily: "$default",
6+
lineHeight: "$short",
7+
margin: 0,
8+
color: "$gray100",
9+
10+
variants: {
11+
size: {
12+
sm: { fontSize: "$xl" },
13+
md: { fontSize: "$2xl" },
14+
lg: { fontSize: "$4xl" },
15+
"2xl": { fontSize: "$5xl" },
16+
"3xl": { fontSize: "$6xl" },
17+
"4xl": { fontSize: "$7xl" },
18+
"5xl": { fontSize: "$8xl" },
19+
"6xl": { fontSize: "$9xl" },
20+
},
21+
},
22+
defaultVariants: {
23+
size: "md",
24+
},
25+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { MultiStepProps } from "../../types/MultiStepProps";
2+
import { Label, MultiStepContainer, Step, Steps } from "./styles";
3+
4+
export function MultiStep({ size, currentStep = 1 }: MultiStepProps) {
5+
return (
6+
<MultiStepContainer>
7+
<Label>
8+
Passo {currentStep} de {size}
9+
</Label>
10+
11+
<Steps css={{ "--steps-size": size }}>
12+
{Array.from({ length: size }, (_, i) => i + 1).map((step) => {
13+
return <Step key={step} active={currentStep >= step} />;
14+
})}
15+
</Steps>
16+
</MultiStepContainer>
17+
);
18+
}

0 commit comments

Comments
 (0)