-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat/#59] 계좌 UI 구현
- Loading branch information
Showing
21 changed files
with
2,842 additions
and
43 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions
27
ssh-web/src/components/atoms/ProgressBar/ProgressBar.styles.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { tv } from 'tailwind-variants'; | ||
|
||
export const barStyles = tv({ | ||
base: '', | ||
variants: { | ||
color: { | ||
primary: 'bg-primary-500', | ||
secondary: 'bg-secondary-800', | ||
danger: 'bg-danger-500', | ||
warning: 'bg-warning-500', | ||
dark: 'bg-black', | ||
light: 'bg-white text-dark', | ||
}, | ||
size: { | ||
sm: 'h-4 w-64', | ||
md: 'h-6 w-96', | ||
lg: 'h-8 w-[32rem]', | ||
}, | ||
fullWidth: { | ||
true: 'w-full', | ||
}, | ||
}, | ||
defaultVariants: { | ||
variant: 'outlined', | ||
size: 'md', | ||
}, | ||
}); |
11 changes: 11 additions & 0 deletions
11
ssh-web/src/components/atoms/ProgressBar/ProgressBar.types.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { TColor } from '../../../themes/themeBase'; | ||
|
||
export type TBarSize = 'sm' | 'md' | 'lg'; | ||
|
||
export interface ProgressBarProps { | ||
percent: number; | ||
color?: TColor; | ||
size?: TBarSize; | ||
fullWidth?: boolean; | ||
classNameStyles?: string; | ||
} |
19 changes: 19 additions & 0 deletions
19
ssh-web/src/components/atoms/ProgressBar/index.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { ProgressBar } from '.'; | ||
|
||
const meta = { | ||
component: ProgressBar, | ||
} satisfies Meta<typeof ProgressBar>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
percent: 40, | ||
color: 'primary', | ||
size: 'md', | ||
fullWidth: false, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { ProgressBarProps } from './ProgressBar.types'; | ||
import { barStyles } from './ProgressBar.styles'; | ||
|
||
export const ProgressBar: React.FC<ProgressBarProps> = ({ | ||
percent, | ||
color = 'primary', | ||
size = 'md', | ||
fullWidth, | ||
classNameStyles, | ||
}: ProgressBarProps) => { | ||
const [animatedPercent, setAnimatedPercent] = useState(0); | ||
|
||
useEffect(() => { | ||
let start = 0; | ||
const duration = 1250; | ||
const stepTime = Math.abs(Math.floor(duration / percent)); | ||
|
||
const step = () => { | ||
start += 1; | ||
setAnimatedPercent(Math.min(start, percent)); | ||
if (start < percent) { | ||
timeoutId = setTimeout(step, stepTime); | ||
} | ||
}; | ||
|
||
let timeoutId = setTimeout(step, stepTime); | ||
|
||
return () => clearTimeout(timeoutId); | ||
}, [percent]); | ||
|
||
const className = barStyles({ | ||
size: size, | ||
fullWidth, | ||
}); | ||
|
||
const barColor = barStyles({ | ||
color: color, | ||
}); | ||
|
||
return ( | ||
<div | ||
className={`relative ${className} bg-secondary-400 rounded-full overflow-hidden ${classNameStyles}`} | ||
> | ||
<div | ||
className={`absolute h-full rounded-full transition-all duration-1000 ease-out ${barColor}`} | ||
style={{ width: `${animatedPercent}% ` }} | ||
> | ||
{animatedPercent > 3 && ( | ||
<span className="flex justify-center items-center h-full font-bold text-xs text-white"> | ||
{animatedPercent}% | ||
</span> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,57 @@ | ||
import React from 'react'; | ||
import React, { useEffect, useState } from 'react'; | ||
import { AvatarWithLabel } from '../AvatarWithLabel'; | ||
import { Button } from '../../atoms/Button'; | ||
import { FaArrowAltCircleLeft, FaArrowAltCircleRight } from 'react-icons/fa'; | ||
import { api } from '../../../apis/interceptors'; | ||
import { IChild } from '../../../interfaces/userInterface'; | ||
|
||
export const ChangeChild = () => { | ||
const [childrenList, setChildrenList] = useState<IChild[]>([]); | ||
const [selectedChild, setSelectedChild] = useState<number>(0); | ||
const [isloading, setIsLoading] = useState<boolean>(false); | ||
|
||
useEffect(() => { | ||
setIsLoading(true); | ||
api.get(`/api/parents/children`).then((res) => { | ||
setChildrenList(res.data); | ||
setIsLoading(false); | ||
}); | ||
}); | ||
return ( | ||
<div className="flex flex-row items-center mb-2 p-2 px-4 bg-primary-100 rounded-lg p"> | ||
<div className="flex flex-row relative items-center mb-2 p-2 px-4 rounded-lg space-x-3"> | ||
{selectedChild !== 0 && ( | ||
<FaArrowAltCircleLeft | ||
size={24} | ||
onClick={() => { | ||
if (childrenList && childrenList.length > selectedChild - 2) { | ||
setSelectedChild(selectedChild - 1); | ||
} | ||
}} | ||
/> | ||
)} | ||
<AvatarWithLabel | ||
imageUrl="https://media1.tenor.com/m/o2nJ-w0v7lAAAAAC/teemo.gif" | ||
altText="캐릭터" | ||
size="md" | ||
bgColor="blue" | ||
label="차은우" | ||
label={childrenList[selectedChild]?.name} | ||
labelSize="md" | ||
labelWeight="bold" | ||
labelColor="dark" | ||
classNameStyles="bg-primary-100 p-2 rounded-lg" | ||
></AvatarWithLabel> | ||
<Button size="sm" classNameStyles="ml-4"> | ||
변경 | ||
</Button> | ||
|
||
<FaArrowAltCircleRight | ||
className={ | ||
selectedChild !== childrenList.length - 1 ? 'visible' : 'invisible' | ||
} | ||
size={24} | ||
onClick={() => { | ||
if (childrenList && childrenList.length > selectedChild - 1) { | ||
setSelectedChild(selectedChild + 1); | ||
} | ||
}} | ||
/> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
ssh-web/src/components/organisms/AddPromiseModal/AddPromiseModal.types.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export interface AddPromiseModalProps { | ||
countTicket: number; | ||
onUpload: () => void; | ||
onUpload: (content: string) => void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.