-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 클립보드 복사 컴포넌트 구현 Co-authored-by: skylar1220 <[email protected]> * fix: 부모 요소의 너비에 따라 CopyTextButton이 작아지는 문제 해결 * refactor: ReviewGroupDataModal 스타일 조정 - 전체 크기 지정 및 gap 조정 * chore: 불필요한 padding 제거 * chore: index 파일에 CopyTextButton 추가 --------- Co-authored-by: skylar1220 <[email protected]>
- Loading branch information
1 parent
409130c
commit 5bab7c1
Showing
6 changed files
with
52 additions
and
9 deletions.
There are no files selected for viewing
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
27 changes: 27 additions & 0 deletions
27
frontend/src/pages/LandingPage/components/CopyTextButton/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,27 @@ | ||
import CopyIcon from '@/assets/copy.svg'; | ||
|
||
import * as S from './styles'; | ||
|
||
interface CopyTextButtonProps { | ||
targetText: string; | ||
alt: string; | ||
} | ||
|
||
const CopyTextButton = ({ targetText, alt }: CopyTextButtonProps) => { | ||
const handleCopyTextButtonClick = async () => { | ||
try { | ||
await navigator.clipboard.writeText(targetText); | ||
alert('텍스트가 클립보드에 복사되었습니다.'); | ||
} catch (error) { | ||
if (error instanceof Error) throw new Error('텍스트 복사에 실패했습니다.'); | ||
} | ||
}; | ||
|
||
return ( | ||
<S.CopyTextButton onClick={handleCopyTextButtonClick}> | ||
<img src={CopyIcon} alt={alt} /> | ||
</S.CopyTextButton> | ||
); | ||
}; | ||
|
||
export default CopyTextButton; |
9 changes: 9 additions & 0 deletions
9
frontend/src/pages/LandingPage/components/CopyTextButton/styles.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,9 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
export const CopyTextButton = styled.button` | ||
width: 2.4rem; | ||
min-width: 2.4rem; | ||
height: 2.4rem; | ||
border: none; | ||
background: none; | ||
`; |
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