Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9b60188
feature : tooltip add
RunaUXLabs May 16, 2024
ef47398
fix : js add
May 17, 2024
6ebccf9
Merge branch 'fix/components-styld-pin-bboing' into feature/component…
RunaUXLabs May 18, 2024
d6baa5b
fix: css add
RunaUXLabs May 19, 2024
7826945
fix: css add
RunaUXLabs May 20, 2024
d2248ec
Merge pull request #66 from tubeletter/feature/components-styled-tool…
yhyunmin May 26, 2024
888a5ab
feat : styled avatar
May 27, 2024
a12aa17
add: modal 초안완성
RunaUXLabs May 28, 2024
6728ef5
fix: onClick추가
RunaUXLabs May 30, 2024
e3eaec5
fix: 스타일링 추가, open/close기능 수정중
RunaUXLabs May 30, 2024
ccf516f
Merge pull request #68 from tubeletter/feature/components-styled-smile2
yhyunmin May 31, 2024
ef8ef9a
fix: svg아이콘이 정중앙에 올 수 있도록 path값 변경
RunaUXLabs May 31, 2024
71e757d
fix: className확장을 위한 Props 추가
RunaUXLabs May 31, 2024
168d2e2
fix: 버튼 컴포넌트 onclick부재로 임시버튼으로 구현, closeButton에 onclick반영하고 className확장
RunaUXLabs May 31, 2024
97f2d62
fix : 버튼 온클릭 추가
Jun 3, 2024
a24ff15
Merge pull request #67 from tubeletter/feat/styled-components-avatar-…
GaYunKimm Jun 3, 2024
b589764
Merge remote-tracking branch 'origin/fix/components-styled-buttnClick…
RunaUXLabs Jun 3, 2024
cd9b8d1
Merge pull request #69 from tubeletter/origin/feature/components-styl…
RunaUXLabs Jun 3, 2024
b7fbfec
feat : add breadcrumbs
Jun 9, 2024
12333bc
fix : color opt add
Jun 9, 2024
1011ebe
add: menu
RunaUXLabs Jun 9, 2024
456bfae
Merge pull request #70 from tubeletter/feature/components-styled-brea…
GaYunKimm Jun 10, 2024
0e6a702
Merge pull request #71 from tubeletter/origin/feature/components-styl…
RunaUXLabs Jun 11, 2024
acc6010
refactor : Accordion - useState => useReducer
yhyunmin Jun 19, 2024
a9d350b
refactor : Accordion - props 정리, useEffect 추가
yhyunmin Jun 19, 2024
e079433
refactor : Accordion - props 정리, useEffect 추가
yhyunmin Jun 19, 2024
e8017f7
Merge pull request #72 from tubeletter/feature/components-styled-smile2
yhyunmin Jun 20, 2024
d6438fa
new branch:refactor
yhyunmin Jun 19, 2024
9e6596f
refactor : Accordion - useState => useReducer
yhyunmin Jun 19, 2024
4baa1be
refactor : Accordion - props 정리, useEffect 추가
yhyunmin Jun 19, 2024
f32515e
refactor : Accordion - props 정리, useEffect 추가
yhyunmin Jun 19, 2024
89e4426
refactor : Accordion - css
yhyunmin Jun 20, 2024
378bd8a
refactor : Accordion - replaced css by design system
yhyunmin Jun 20, 2024
4bdc81a
changed non fast forward
yhyunmin Jun 20, 2024
7111f77
merge
yhyunmin Jun 20, 2024
b3de653
refactor : Accordion - 자ì ãìˆ스토리북 arg types 수정
yhyunmin Jun 20, 2024
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
Binary file added apps/team-styled/public/mg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,62 @@ import Accordion from './Accordion';
import styled from 'styled-components';
import { ReactNode } from 'react';

export type accordionType = {
state: boolean;
title?: string;
text?: string;
export type AccordionType = {
state?: boolean;
title: string;
text: string;
size: '6xl' | '5xl' | '4xl' | '3xl' | '2xl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
children?: ReactNode;
};

export default {
title: 'chakra-ui-styled/components/disclosure/accordion',
component: Accordion,
parameter: { controls: { expanded: true } },

argTypes: {
state: {
control: {
type: 'boolean',
title: 'Accordion Button',
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
}
size: { control: { type: 'select', options: ['6xl', '5xl', '4xl', '3xl', '2xl', 'xl', 'lg', 'md', 'sm', 'xs'] } },
state: { control: { type: 'boolean' } },
title: { control: { type: 'text' }, description: '제목입니다.' },
text: { control: { type: 'text' } },
arg: {
size: 'md', // 기본 size 값
state: true, // 기본 state 값
title: '기본 제목', // 기본 title 문구
text: '기본 텍스트' // 기본 text 문구
}
}
};

const Container = styled.div``;
export const AccordionComponent = (args: accordionType) => {
export const AccordionComponent = (args: AccordionType) => {
return (
<>
<Container>
<h2>Accordion Demo</h2>
<p> 스토리북 설정 </p>
<Accordion {...args}>
<Accordion.Toggle title={args.title ?? 'Accordion Button'}>
<Accordion.Panel
text={
args.text ??
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
}
/>
<Accordion.Toggle>
<Accordion.Panel />
</Accordion.Toggle>
</Accordion>
<br />
<hr />
<br />
<Accordion state={false}>
<Accordion.Toggle title={'Accordion Button'} />
<Accordion state={false} title="just Sample state false" size="md" text="text">
<Accordion.Toggle />
</Accordion>
<Accordion state={true}>
<Accordion.Toggle title={'Accordion Button'} />
<Accordion state={true} title="just Sample state true" size="md" text="text">
<Accordion.Toggle />
</Accordion>
<Accordion state={true}>
<Accordion.Toggle title={'Accordion Button'}>
<Accordion.Panel
text={
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
}
/>
<Accordion state={false} title="u can click to expand" size="md" text="text">
<Accordion.Toggle>
<Accordion.Panel />
</Accordion.Toggle>
</Accordion>
</Container>
</>
);
};
const Container = styled.div``;

AccordionComponent.storyName = 'Accordion';
Original file line number Diff line number Diff line change
@@ -1,47 +1,69 @@
import { accordionType } from './Accordion.stories';
import { createContext, ReactNode, useContext, useState } from 'react';
import { AccordionType } from './Accordion.stories';
import { createContext, ReactNode, useContext, useEffect, useReducer } from 'react';
import styled, { css } from 'styled-components';
import { BaseText } from '../../../foundation/typography/Text';

const AccordionContext = createContext({
isOpen: false,
setIsOpen: (value: boolean) => {}
type AccordionContextType = AccordionType & {
isOpen: boolean;
setIsOpen: () => void;
};
const AccordionContext = createContext<AccordionContextType>({
isOpen: true,
setIsOpen: () => {},
title: '',
text: '',
size: 'md'
});

const Accordion = ({ state, children }: accordionType) => {
const [isOpen, setIsOpen] = useState(state);
const Accordion = ({ state = true, children, size, title, text }: AccordionType) => {
// const [isOpen, setIsOpen] = useState(state);
// boolean useReducer 이용하여 관리,
const [isOpen, setIsOpen] = useReducer((state) => !state, state);
const providerValue = {
isOpen,
setIsOpen
setIsOpen,
title,
size,
text
};

// 스토리북 arg 작동을 위한 useEffect
useEffect(() => {
setIsOpen();
}, [state]);

return (
<AccordionContext.Provider value={providerValue}>
<Container>{children}</Container>
</AccordionContext.Provider>
);
};

const Toggle = ({ title, children }: { title: string; children?: ReactNode }) => {
const { isOpen, setIsOpen } = useContext(AccordionContext);
const Toggle = ({ children }: { children?: ReactNode }) => {
const { isOpen, setIsOpen, title, size = 'md' } = useContext(AccordionContext);

return (
<div onClick={() => setIsOpen(!isOpen)}>
<div onClick={setIsOpen}>
{/*isOpen 통해 svg 방향 바꿈*/}
<TitleBox isOpen={isOpen}>
<h5>{title}</h5>
<div>
{/* 아이콘 */}
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M16.59 8.59L12 13.17L7.41 8.59L6 10L12 16L18 10L16.59 8.59Z" fill="black" />
</svg>
</div>
</TitleBox>
<p>{children}</p>

<BaseText size={size}>{children}</BaseText>
</div>
);
};

const Panel = ({ text }: { text: string }) => {
const { isOpen } = useContext(AccordionContext);
const Panel = () => {
const { isOpen, text, size } = useContext(AccordionContext);

return isOpen && <TextBox>{text}</TextBox>;
return !isOpen && <BaseText size={size}>{text}</BaseText>;
};

Accordion.Toggle = Toggle;
Expand All @@ -54,35 +76,39 @@ const TitleBox = styled.div<{ isOpen: boolean }>`
justify-content: space-between;
flex: 1;
width: inherit;
max-width: 345px;
//max-width: 345px;
user-select: none;
${({ isOpen }) =>
isOpen &&
!isOpen &&
css`
div {
transform: rotate(180deg);
}
`}
`;
const TextBox = styled.div`
font-size: 16px;
font-weight: 400;
`;
// const TextBox = styled.div`
// font-size: 16px;
// font-weight: 400;
// `;

const Container = styled.article`
display: flex;
justify-content: space-between;
align-items: center;
width: 403px;
border-block: 1px solid #d0d0d0;
//width: 403px;
border-block: ${({ theme }) => theme.spacing.px} solid ${({ theme }) => theme.color.gray[300]};
padding: 10px 12px;
h5 {
font-size: 16px;
font-weight: 400;
${({ theme }) => theme.typo.text.md}
}
> div {
display: flex;
width: 100%;
flex-direction: column;
}
`;

//
//
//
//TODO : 디자인시스템 css 바꾸기
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface ButtonProps {
children?: string;
leftIcon?: React.ReactNode;
rightIcon?: React.ReactNode;
onClick?: () => void;
}
const setIcon = (icon: React.ReactNode) => {
return <figure className="icon">{icon}</figure>;
Expand All @@ -21,10 +22,11 @@ const Button = ({
colorScheme,
leftIcon,
rightIcon,
children
children,
onClick
}: ButtonProps) => {
return (
<StyleButton as={as} size={size} colorScheme={colorScheme} variant={variant}>
<StyleButton as={as} size={size} colorScheme={colorScheme} variant={variant} onClick={onClick}>
{leftIcon && setIcon(leftIcon)}
{children && (
<StyleText size={size} weight="semibold">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
export const CloseIconStyle = () => {
return (
<svg width="currentSize" height="currentSize" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M6 4.66688L10.6669 0L12 1.33312L7.33312 6L12 10.6669L10.6669 12L6 7.33312L1.33312 12L0 10.6669L4.66688 6L0 1.33312L1.33312 0L6 4.66688Z"
fill="currentColor"
/>
<path d="M12 10.8891L15.8891 7L17 8.11094L13.1109 12L17 15.8891L15.8891 17L12 13.1109L8.11094 17L7 15.8891L10.8891 12L7 8.11094L8.11094 7L12 10.8891Z" fill="currentColor"/>
</svg>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@ import styled from 'styled-components';
export interface CloseButtonProps {
size: 'sm' | 'md' | 'lg';
icon?: React.ReactNode;
onClick?: () => void;
className?: string;
}
const ViewBoxSize = { sm: 24, md: 32, lg: 40 };
const setIcon = (icon: React.ReactNode) => {
return <figure className="icon">{icon}</figure>;
};
const CloseButtonStyle = styled.div<CloseButtonProps>`
display: flex;
align-items: center;
justify-content: center;
width: ${({ size }) => ViewBoxSize[size]}px;
height: ${({ size }) => ViewBoxSize[size]}px;
aspect-ratio: 1;
cursor: pointer;
`;
const CloseButton = ({ size = 'sm', icon }: CloseButtonProps) => {
const CloseButton = ({ size = 'sm', icon, className, onClick }: CloseButtonProps) => {
return (
<CloseButtonStyle size={size}>
<CloseButtonStyle size={size} onClick={onClick} className={className}>
{icon && setIcon(icon)}
</CloseButtonStyle>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,33 @@ const PinInputSize = {
width: ${({ theme }) => theme.spacing[12]};
border-radius: 6px;
${({ theme }) => theme.typo.text.lg}
`,
`
};
export const StylePinInput = styled.div.attrs({ autoFocus: true })<PinInputProps>`
display: flex;
gap: 6px;
& input{

& input {
${({ size }) => PinInputSize[size]}
${({ colorScheme, theme }) => css`
border: 1px solid ${theme.color.gray[200]};

&:focus {
outline: 2px solid ${theme.color[colorScheme][500]};
}

&:placeholder-shown {
color: ${theme.color.gray[400]};
}
`}
}
`;

export const PinInputField = styled.input.attrs({ type: "text", maxlength: 1, placeholder: "○" })`
text-align: center;
export const PinInputField = styled.input.attrs({ type: 'text', maxlength: 1, placeholder: '○' })`
aspect-ratio: 1;
text-align: center;

&:focus {
outline: 0;
outline: 0;
}

`;
`;
Loading