Skip to content

Commit

Permalink
Merge pull request #6 from Principes-Artis-Mechanicae/feature/GETP-106
Browse files Browse the repository at this point in the history
GETP-106 feature: Button, Input, Label 컴포넌트 구현
  • Loading branch information
toothlessdev authored Mar 29, 2024
2 parents 102993e + 9f3a0b4 commit d5eb974
Show file tree
Hide file tree
Showing 17 changed files with 159 additions and 1 deletion.
Binary file added src/assets/auth/client-active.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/auth/client.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/auth/congrats1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/auth/congrats2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/auth/people-active.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/auth/people.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/auth/people1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/auth/people2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/auth/people3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/auth/rocket.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion src/common/form/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { place_center } from "@/styles/utils";
import styled from "@emotion/styled";

export interface IButton {
variant: "primary" | "secondary" | "outline" | "disabled";
variant: "primary" | "secondary" | "outline" | "disabled" | "side";

width: string;
height: string;
Expand All @@ -27,6 +27,8 @@ export const Button = styled.button<IButton>`
return "#fff";
case "disabled":
return "#EBEDEF";
case "side":
return "#fff";
}
}};
Expand All @@ -40,6 +42,8 @@ export const Button = styled.button<IButton>`
return "#476FF1";
case "disabled":
return "#C4C7CC";
case "side":
return "#021026";
}
}};
Expand Down
72 changes: 72 additions & 0 deletions src/common/form/Input.story.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { Button } from "./Button";
import { Input } from "./Input";
import { css } from "@emotion/react";
import type { Meta, StoryObj } from "@storybook/react";

const meta = {
title: "form/Input",
component: Input,
} satisfies Meta<typeof Input>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Text: Story = {
args: {
type: "text",
width: "300px",
height: "45px",
placeholder: "이메일 주소를 입력해주세요",
},
};

export const Password: Story = {
args: {
type: "password",
width: "300px",
height: "45px",
placeholder: "비밀번호를 입력해주세요",
},
};

export const Email: Story = {
args: {
type: "email",
width: "300px",
height: "45px",
},
render: (args) => {
return (
<Input width={args.width} height={args.height} placeholder="이메일 주소를 입력해주세요">
<Button variant="side" width="40px" height="45px">
인증
</Button>
</Input>
);
},
};

export const Verify: Story = {
args: {
type: "text",
width: "300px",
height: "45px",
},
render: (args) => {
return (
<Input width={args.width} height={args.height} placeholder="인증번호를 입력해주세요">
<div
css={css`
display: flex;
align-items: center;
color: #476ff1;
font-weight: bold;
height: 100%;
`}
>
4:30
</div>
</Input>
);
},
};
41 changes: 41 additions & 0 deletions src/common/form/Input.style.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import styled from "@emotion/styled";

export interface IInputWrapper {
width: string;
height: string;
}

export interface IInputElement extends React.ComponentProps<"input"> {
width: string;
height: string;
}

export const InputWrapper = styled.div<IInputWrapper>`
width: ${(props) => props.width};
height: ${(props) => props.height};
position: relative;
`;

export const InputElement = styled.input<IInputElement>`
width: ${(props) => props.width};
height: ${(props) => props.height};
border: 0;
border-bottom: 1px solid #ebedef;
font-size: 16px;
&:focus {
outline: none;
border-bottom: 1.5px solid #476ff1;
}
`;

export const InputOption = styled.div`
height: 100%;
position: absolute;
right: 0;
top: 0;
`;
14 changes: 14 additions & 0 deletions src/common/form/Input.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { IInputElement, InputElement, InputOption, InputWrapper } from "./Input.style";

export interface IInput extends IInputElement {
children?: React.ReactNode;
}

export const Input: React.FC<IInput> = ({ width, height, children, ...rest }) => {
return (
<InputWrapper width={width} height={height}>
<InputElement width={width} height={height} {...rest}></InputElement>
<InputOption>{children}</InputOption>
</InputWrapper>
);
};
16 changes: 16 additions & 0 deletions src/common/form/Label.story.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Label } from "./Label";
import type { Meta, StoryObj } from "@storybook/react";

const meta = {
title: "form/Label",
component: Label,
} satisfies Meta<typeof Label>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
children: "LABEL",
},
};
6 changes: 6 additions & 0 deletions src/common/form/Label.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import styled from "@emotion/styled";

export const Label = styled.label`
font-size: 12px;
font-weight: bold;
`;
5 changes: 5 additions & 0 deletions src/common/test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import imgSrc from "@/assets/3d00772.png";

export const Test = () => {
return <img src={imgSrc}></img>;
};

0 comments on commit d5eb974

Please sign in to comment.