Repository navigation
feat: 공통 UI 컴포넌트 - StatusBadge, Tab, 진행 상태 #33
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
811cedd
feat: 사건조회 페이지 판결,유형 tab 공통 컴포넌트 생성
wjdalss21 a2f5ff4
feat: 사건 관련 페이지의 진행 상태 컴포넌트
wjdalss21 f42f802
Merge remote-tracking branch 'origin/dev' into feature/common-compone…
wjdalss21 5da994c
fix: StatusBadge CSS 변수 하드코딩 제거 및 Tab className trailing space 수정
wjdalss21 3ede2bc
fix: StatusBadge 크기 조정 및 .playwright-mcp gitignore 추가
wjdalss21 c247db8
Merge branch 'dev' into feature/common-component-jm
wjdalss21 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -24,6 +24,9 @@ coverage | |
| # TypeScript | ||
| tsconfig.tsbuildinfo | ||
|
|
||
| # MCP | ||
| .playwright-mcp/ | ||
|
|
||
| # Logs | ||
| *.log | ||
| npm-debug.log* | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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,36 @@ | ||
| @use '../../styles/abstracts/functions' as fn; | ||
|
|
||
| .badge { | ||
| display: inline-flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| align-self: flex-start; | ||
| min-width: fn.r(58); | ||
| height: fn.r(24); | ||
| padding: fn.r(2) fn.r(8); | ||
| border-radius: fn.r(4); | ||
| font-size: 0.75rem; | ||
| font-weight: 600; | ||
| line-height: 1rem; | ||
| white-space: nowrap; | ||
|
|
||
| &--done { | ||
| background-color: var(--status-done-bg); | ||
| color: var(--status-done-text); | ||
| } | ||
|
|
||
| &--progress { | ||
| background-color: var(--status-progress-bg); | ||
| color: var(--status-progress-text); | ||
| } | ||
|
|
||
| &--disabled { | ||
| background-color: var(--status-disabled-bg); | ||
| color: var(--status-disabled-text); | ||
| } | ||
|
|
||
| &--error { | ||
| background-color: var(--status-danger-bg); | ||
| color: var(--status-danger-text); | ||
| } | ||
| } |
This file contains hidden or 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,40 @@ | ||
| import styles from './StatusBadge.module.scss'; | ||
|
|
||
| type DisputeStatus = | ||
| | 'draft' | ||
| | 'waiting_opponent' | ||
| | 'opponent_joined' | ||
| | 'both_submitted' | ||
| | 'judging' | ||
| | 'judged' | ||
| | 'closed' | ||
| | 'expired' | ||
| | 'deleted'; | ||
|
|
||
| type StatusVariant = 'done' | 'progress' | 'disabled' | 'error'; | ||
|
|
||
| interface StatusBadgeProps { | ||
| status: DisputeStatus; | ||
| } | ||
|
|
||
| const STATUS_MAP: Record<DisputeStatus, { variant: StatusVariant; label: string }> = { | ||
| draft: { variant: 'progress', label: '진행중' }, | ||
| waiting_opponent: { variant: 'progress', label: '진행중' }, | ||
| opponent_joined: { variant: 'progress', label: '진행중' }, | ||
| both_submitted: { variant: 'progress', label: '진행중' }, | ||
| judging: { variant: 'progress', label: '진행중' }, | ||
| judged: { variant: 'done', label: '진행완료' }, | ||
| closed: { variant: 'done', label: '진행완료' }, | ||
| expired: { variant: 'disabled', label: '진행불가' }, | ||
| deleted: { variant: 'error', label: '진행오류' }, | ||
| }; | ||
|
|
||
| export default function StatusBadge({ status }: StatusBadgeProps) { | ||
| const { variant, label } = STATUS_MAP[status]; | ||
|
|
||
| return ( | ||
| <span className={`${styles.badge} ${styles[`badge--${variant}`]}`}> | ||
| {label} | ||
| </span> | ||
| ); | ||
| } |
This file contains hidden or 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,31 @@ | ||
| @use '../../styles/abstracts/functions' as fn; | ||
|
|
||
| .tabList { | ||
| display: inline-flex; | ||
| gap: fn.r(8); | ||
| } | ||
|
|
||
| .tabItem { | ||
| height: fn.r(44); | ||
| padding: 0 fn.r(16); | ||
| border-radius: fn.r(8); | ||
| font-family: var(--font-family-base); | ||
| font-size: 1rem; | ||
| line-height: 1.5rem; | ||
| cursor: pointer; | ||
| transition: all 0.15s ease; | ||
| border: 1.5px solid var(--border-strong); | ||
|
|
||
| &--inactive { | ||
| background-color: var(--bg-page); | ||
| color: var(--text-secondary); | ||
| font-weight: 400; | ||
| } | ||
|
|
||
| &--active { | ||
| background-color: var(--bg-page); | ||
| color: var(--text-primary); | ||
| font-weight: 700; | ||
| border-color: var(--text-primary); | ||
| } | ||
| } | ||
This file contains hidden or 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,33 @@ | ||
| import styles from './Tab.module.scss'; | ||
|
|
||
| export interface TabItem { | ||
| label: string; | ||
| value: string; | ||
| } | ||
|
|
||
| interface TabProps { | ||
| items: TabItem[]; | ||
| activeValue: string; | ||
| onChange: (value: string) => void; | ||
| className?: string; | ||
| } | ||
|
|
||
| export default function Tab({ items, activeValue, onChange, className }: TabProps) { | ||
| return ( | ||
| <div className={[styles.tabList, className].filter(Boolean).join(' ')}> | ||
| {items.map((item) => { | ||
| const isActive = item.value === activeValue; | ||
| return ( | ||
| <button | ||
| key={item.value} | ||
| className={`${styles.tabItem} ${isActive ? styles['tabItem--active'] : styles['tabItem--inactive']}`} | ||
| onClick={() => onChange(item.value)} | ||
| type="button" | ||
| > | ||
| {item.label} | ||
|
evenif99 marked this conversation as resolved.
|
||
| </button> | ||
| ); | ||
| })} | ||
| </div> | ||
| ); | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.