Skip to content

Commit

Permalink
refactor/#25 Add color for toolbar click
Browse files Browse the repository at this point in the history
  • Loading branch information
ShinKwang2 committed Jun 28, 2024
1 parent dd967e0 commit c28d51c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
21 changes: 21 additions & 0 deletions src/components/ui/Stack.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { HTMLAttributes, PropsWithChildren } from 'react';

interface StackProps extends HTMLAttributes<HTMLDivElement> {
rotated?: boolean;
}

export const VStack = (props: PropsWithChildren<StackProps>) => {
const { children, className = '', rotated, ...attributes } = props;
return (
<div
{...attributes}
className={`flex gap-1 ${rotated ? 'flex-row' : 'flex-col'} ${className}`}
>
{children}
</div>
);
};
export const HStack = (props: PropsWithChildren<StackProps>) =>
VStack({ ...props, rotated: !props.rotated });

export const Spacer = () => <div className='flex-grow' />;
10 changes: 1 addition & 9 deletions src/components/ui/ToolBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,10 @@ const ToolBar = ({ options = mockData }: ToolBarProps) => {
return (
<>
<div className='flex justify-evenly min-h-12 items-center border-b border-gray-200'>
{/* <div className='w-1/2 bg-red-300 text-center'>나의 사업장</div> */}
{/* <div className='w-1/2 bg-blue-300 text-center'>캘린더</div> */}
{/* <button className='bg-blue-300 px-8 py-3'>
<ToolBarDetail title={'나의 사업장'} />
</button>
<button className='bg-red-400 px-8 py-3'>
<ToolBarDetail title={'캘린더'} />
</button> */}
{options.map((option, idx) => (
<button
key={option}
className={`bg-white px-8 py-3 ${idx == selected ? 'border-b boder-b-2 border-hanaLightGreen' : ''}`}
className={`bg-white px-8 py-3 ${idx == selected ? 'border-b-2 border-hanaLightGreen' : ''}`}
onClick={() => onClickSelect(idx)}
disabled={selected == idx}
>
Expand Down
4 changes: 3 additions & 1 deletion src/components/ui/ToolBarDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ type ToolBarDetailProps = {

const ToolBarDetail = ({ title, isSelected }: ToolBarDetailProps) => {
return (
<div className={`transition-all ${isSelected ? 'font-bold' : ''}`}>
<div
className={`transition-all ${isSelected ? 'font-bold text-hanaLightGreen' : ''}`}
>
{title}
</div>
);
Expand Down

0 comments on commit c28d51c

Please sign in to comment.