-
Notifications
You must be signed in to change notification settings - Fork 6
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
fix-fe: ProcessColumn QA #428
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
61ae75d
Create draft PR for #427
github-actions[bot] 1db9840
chore: ProcessColumn의 너비를 25rem으로 고정
llqqssttyy a99ac5d
feat: 프로세스 컬럼에 설명 추가
llqqssttyy d880f3e
chore: 더보기에 말 줄임표 삭제
llqqssttyy bd2a904
chore: ProcessColumn의 너비를 28rem으로 변경
llqqssttyy 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
35 changes: 35 additions & 0 deletions
35
.../src/components/dashboard/ProcessColumn/ProcessDescription/ProcessDescription.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,35 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import ProcessDescription from './index'; | ||
|
||
const meta: Meta<typeof ProcessDescription> = { | ||
title: 'Components/ProcessColumn/ProcessDescription', | ||
component: ProcessDescription, | ||
parameters: { | ||
layout: 'centered', | ||
docs: { | ||
description: { | ||
component: '프로세스의 설명을 렌더링합니다. 더보기 버튼을 클릭하면 설명이 전체로 펼쳐집니다.', | ||
}, | ||
}, | ||
}, | ||
tags: ['autodocs'], | ||
decorators: [ | ||
(Child) => ( | ||
<div | ||
style={{ | ||
width: '25rem', | ||
}} | ||
> | ||
<Child /> | ||
</div> | ||
), | ||
], | ||
args: { | ||
description: '프로세스 설명입니다.', | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof ProcessDescription>; | ||
|
||
export const Default: Story = {}; | ||
32 changes: 32 additions & 0 deletions
32
frontend/src/components/dashboard/ProcessColumn/ProcessDescription/index.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,32 @@ | ||
import { useLayoutEffect, useRef, useState } from 'react'; | ||
import S from './style'; | ||
|
||
interface ProcessDescriptionProps { | ||
description: string; | ||
} | ||
|
||
export default function ProcessDescription({ description }: ProcessDescriptionProps) { | ||
const [isOverflow, setOverflow] = useState(false); | ||
const [showMore, setShowMore] = useState(false); | ||
|
||
const toggleShowMore = () => setShowMore((prev) => !prev); | ||
Comment on lines
+10
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
const descriptionRef = useRef<HTMLDivElement>(null); | ||
useLayoutEffect(() => { | ||
if (descriptionRef.current) { | ||
setOverflow(descriptionRef.current.scrollWidth > descriptionRef.current.clientWidth); | ||
} | ||
}, [description]); | ||
|
||
return ( | ||
<S.Container showMore={showMore}> | ||
<S.Description | ||
ref={descriptionRef} | ||
showMore={showMore} | ||
> | ||
{description} | ||
</S.Description> | ||
{isOverflow && <S.MoreButton onClick={toggleShowMore}>{showMore ? '접기' : '더보기'}</S.MoreButton>} | ||
</S.Container> | ||
); | ||
} |
48 changes: 48 additions & 0 deletions
48
frontend/src/components/dashboard/ProcessColumn/ProcessDescription/style.ts
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,48 @@ | ||
import { css } from '@emotion/react'; | ||
import styled from '@emotion/styled'; | ||
|
||
const Container = styled.div<{ showMore: boolean }>` | ||
width: 100%; | ||
display: flex; | ||
align-items: baseline; | ||
${({ showMore }) => | ||
showMore && | ||
css` | ||
flex-direction: column; | ||
align-items: flex-end; | ||
`} | ||
`; | ||
|
||
const Description = styled.p<{ showMore: boolean }>` | ||
width: 100%; | ||
${({ theme }) => theme.typography.common.block}; | ||
color: ${({ theme }) => theme.baseColors.grayscale[700]}; | ||
margin-bottom: 0; | ||
padding: 0.4rem; | ||
${({ showMore }) => | ||
!showMore && | ||
css` | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
`} | ||
`; | ||
|
||
const MoreButton = styled.button` | ||
${({ theme }) => theme.typography.common.block}; | ||
color: ${({ theme }) => theme.baseColors.grayscale[500]}; | ||
white-space: nowrap; | ||
margin: 0; | ||
`; | ||
|
||
const S = { | ||
Container, | ||
Description, | ||
MoreButton, | ||
}; | ||
|
||
export default S; |
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
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.