Skip to content

Commit

Permalink
Merge pull request #21 from primus-teoSprint/feat/#20
Browse files Browse the repository at this point in the history
[#20] ์•„์ด๋””์–ด ์œ ํ˜• ์„ ํƒ ์ปดํฌ๋„ŒํŠธ
  • Loading branch information
03hoho03 authored May 13, 2024
2 parents 7703c0e + 3fa0ae2 commit bd82f5f
Show file tree
Hide file tree
Showing 11 changed files with 246 additions and 0 deletions.
129 changes: 129 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"dependencies": {
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-toggle-group": "^1.0.4",
"@tanstack/react-query": "^5.34.1",
"axios": "^1.6.8",
"dayjs": "^1.11.11",
Expand Down
62 changes: 62 additions & 0 deletions src/components/IdeaTypeGroup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
'use client'

import React from 'react'
import { ToggleGroupItem, ToggleGroupRoot } from './common/ToggleGroup'
import { typeDatas } from '@/constants/idea'
import styled from 'styled-components'
import { theme } from '@/styles/theme'
import { useAtom } from 'jotai'
import { selectedIdeaTypeAtom } from '@/store/atoms/idea'

const StyledToggleGroupRoot = styled(ToggleGroupRoot)`
display: grid;
grid-template-columns: repeat(5, 60px);
row-gap: 4px;
column-gap: 4px;
justify-content: center;
`
const StyledToggleGroupItem = styled(ToggleGroupItem)`
/* ๊ธฐ๋ณธ ์Šคํƒ€์ผ */
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 60px;
height: 24px;
font-size: 0.8125rem;
font-weight: ${theme.fontWeight.bold};
color: #767676;
background-color: ${theme.color.white};
border: 1px solid ${theme.color.grey500};
border-radius: 12px;
cursor: pointer;
/* ์„ ํƒ ์‹œ ์Šคํƒ€์ผ */
&[data-state='on'] {
background-color: ${theme.color.purple700};
color: ${theme.color.white};
border: none;
}
`

const IdeaTypeGroup = () => {
const [value, setValue] = useAtom(selectedIdeaTypeAtom)

return (
<StyledToggleGroupRoot
type="single"
value={value}
onValueChange={(value) => {
if (value) setValue(value)
}}
>
{typeDatas.map((content, idx) => (
<StyledToggleGroupItem key={`${content}-${idx}`} value={content}>
{content}
</StyledToggleGroupItem>
))}
</StyledToggleGroupRoot>
)
}

export default IdeaTypeGroup
15 changes: 15 additions & 0 deletions src/components/common/ToggleGroup/Item.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use client'

import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group'
import React from 'react'

export interface ToggleGroupItemProps
extends ToggleGroupPrimitive.ToggleGroupItemProps {}

const ToggleGroupItem = ({ children, ...props }: ToggleGroupItemProps) => {
return (
<ToggleGroupPrimitive.Item {...props}>{children}</ToggleGroupPrimitive.Item>
)
}

export default ToggleGroupItem
7 changes: 7 additions & 0 deletions src/components/common/ToggleGroup/Root.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use client'

import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group'

const ToggleGroupRoot = ToggleGroupPrimitive.Root

export default ToggleGroupRoot
4 changes: 4 additions & 0 deletions src/components/common/ToggleGroup/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import ToggleGroupRoot from '@/components/common/ToggleGroup/Root'
import ToggleGroupItem from '@/components/common/ToggleGroup/Item'

export { ToggleGroupItem, ToggleGroupRoot }
22 changes: 22 additions & 0 deletions src/constants/idea.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export const typeDatas = [
'์‹ํ’ˆ',
'ํ—ฌ์Šค์ผ€์–ด',
'๊ณผํ•™',
'๊ฒฝ์ œ',
'๊ต์œก',
'AI',
'ํ†ต์‹ ',
'์ œ์กฐ',
'๋ธ”๋ก์ฒด์ธ',
'๋ฐ์ดํ„ฐ',
'๋น„์ฆˆ๋‹ˆ์Šค',
'๋”ฅํ…Œํฌ',
'ํ•˜๋“œ์›จ์–ด',
'STO',
'์ปค๋จธ์Šค',
'์ธ์‚ฌ',
'๋ฒ•๋ฅ ',
'๋ฐ”์ด์˜ค',
'ํ•€ํ…Œํฌ',
'์ปคํ”ผ',
]
Empty file removed src/store/.gitkeep
Empty file.
4 changes: 4 additions & 0 deletions src/store/atoms/idea.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { typeDatas } from '@/constants/idea'
import { atom } from 'jotai'

export const selectedIdeaTypeAtom = atom(typeDatas[0])
1 change: 1 addition & 0 deletions src/store/atoms/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@/store/atoms/idea'
1 change: 1 addition & 0 deletions src/store/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@/store/atoms'

0 comments on commit bd82f5f

Please sign in to comment.