Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

디자인 변경에 따른 프로그래스바 변경 #46

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/app/test/Staging.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Fragment, useEffect } from "react";
import { css } from "@emotion/react";
import { Fragment, useEffect, useState } from "react";

import { BottomSheet } from "@/component/BottomSheet";
import { Button, ButtonProvider } from "@/component/common/button";
import { CheckBox, CheckBoxGroup } from "@/component/common/checkBox";
import { Input, InputLabelContainer, Label } from "@/component/common/input";
import { ProgressBar } from "@/component/common/ProgressBar";
import { Radio, RadioButtonGroup } from "@/component/common/radioButton";
import { useBottomSheet } from "@/hooks/useBottomSheet.ts";
import { useCheckBox } from "@/hooks/useCheckBox";
Expand All @@ -15,6 +17,7 @@ export default function Staging() {
const [isRadioChecked, onChange, selectedValue] = useRadioButton();
const [isCheckBoxChecked, toggle, selectedValues] = useCheckBox();
const { openBottomSheet, bottomSheetState } = useBottomSheet();
const [number, setNumber] = useState(0);
const [layerName, handleChangeName] = useInput();

useEffect(() => {
Expand All @@ -31,6 +34,15 @@ export default function Staging() {

return (
<DefaultLayout>
<ProgressBar
curPage={number}
lastPage={5}
css={css`
margin-bottom: 1rem;
`}
/>
<Button onClick={() => setNumber(number + 1)}>업</Button>
<Button onClick={() => setNumber(number - 1)}>다운</Button>
<Button onClick={openBottomSheet}> 그냥 그저 그런 버튼 </Button>
<Button colorSchema={"gray"}> 그냥 그저 그런 버튼 </Button>
<Button colorSchema={"sky"}> 그냥 그저 그런 버튼 </Button>
Expand Down
30 changes: 0 additions & 30 deletions src/component/ProgressBar/ProgressBar.tsx

This file was deleted.

50 changes: 50 additions & 0 deletions src/component/common/ProgressBar/ProgressBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { css } from "@emotion/react";
import { Fragment } from "react";

type ProgressBarProps = {
curPage: number;
lastPage: number;
} & Omit<React.HTMLAttributes<HTMLDivElement>, "type">;

export function ProgressBar({ curPage, lastPage, ...props }: ProgressBarProps) {
if (curPage > lastPage) curPage = lastPage;

const segments = Array.from({ length: lastPage }, (_, i) => i < curPage);

return (
<div
css={css`
display: flex;
width: 100%;
justify-content: space-between;
gap: 0.5rem;
`}
{...props}
>
{segments.map((isActive, index) => (
<Fragment key={index}>
<div
css={css`
position: relative;
width: 100%;
background-color: #f1f3f5;
border-radius: 5rem;
height: 0.4rem;
`}
>
<div
css={css`
position: absolute;
width: ${isActive ? 100 : 0}%;
background-color: #608dff;
border-radius: 5rem;
height: inherit;
transition: 0.4s all;
`}
/>
</div>
</Fragment>
))}
</div>
);
}
1 change: 1 addition & 0 deletions src/component/common/ProgressBar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ProgressBar } from "./ProgressBar.tsx";
Loading