From f435e3cd6d5290356fe1f3054b20c8c3fdf6a2e3 Mon Sep 17 00:00:00 2001 From: minpeter Date: Mon, 22 Apr 2024 16:55:00 +0900 Subject: [PATCH] Refactor FileListBox component to use styled.a instead of styled.div --- src/components/FileListBox/index.tsx | 26 ++++++++++++-------------- src/components/FileListBox/styled.ts | 15 ++++++++++++--- src/pages/download/index.tsx | 27 +++++++++++++-------------- src/pages/download/styled.ts | 3 +++ 4 files changed, 40 insertions(+), 31 deletions(-) diff --git a/src/components/FileListBox/index.tsx b/src/components/FileListBox/index.tsx index 106ebbe..a5666d4 100644 --- a/src/components/FileListBox/index.tsx +++ b/src/components/FileListBox/index.tsx @@ -18,20 +18,18 @@ export function FileListBox({ setDownloading, }: FileListBoxProps) { return ( - - { - e.preventDefault(); - setDownloading(true); - await downloadFile(downloadUrl, filename); - setDownloading(false); - }} - > - {filename} / {getFileSize(size)} - {downloading && size >= 2000_000 ? ' / 다운로드 중...' : ''} - + { + e.preventDefault(); + setDownloading(true); + await downloadFile(downloadUrl, filename); + setDownloading(false); + }} + > + {filename} / {getFileSize(size)} + {downloading && size >= 2000_000 ? ' / 다운로드 중...' : ''} ); } diff --git a/src/components/FileListBox/styled.ts b/src/components/FileListBox/styled.ts index dec88d1..dc71f6c 100644 --- a/src/components/FileListBox/styled.ts +++ b/src/components/FileListBox/styled.ts @@ -1,15 +1,24 @@ import styled from '@emotion/styled'; -export const FileListBoxContainer = styled.div` +export const FileListBoxContainer = styled.a` + width: fit-content; + background-color: var(--color-backgorund-filelistbox); color: var(--color-text-tertiary); + border-radius: 1rem; padding: 1.2rem 1.2rem 1.2rem 1.2rem; + display: flex; flex-direction: row; justify-content: center; - align-items: flex-start; + align-items: center; + font-size: 2.2rem; - margin-bottom: 1.5rem; + margin: 0.5rem auto; + cursor: pointer; + + text-wrap: balance; + text-align: center; `; diff --git a/src/pages/download/index.tsx b/src/pages/download/index.tsx index 2812366..c3a340d 100644 --- a/src/pages/download/index.tsx +++ b/src/pages/download/index.tsx @@ -70,21 +70,20 @@ export function DownloadPage() { {fileProps.files.map((file: FileListBoxProps, index: number) => ( -
- { - const updatedItemDownloading = [...itemDownloading]; - updatedItemDownloading[index] = downloading; - setItemDownloading(updatedItemDownloading); + { + const updatedItemDownloading = [...itemDownloading]; + updatedItemDownloading[index] = downloading; + setItemDownloading(updatedItemDownloading); - return downloading; - }} - /> -
+ return downloading; + }} + /> ))}
diff --git a/src/pages/download/styled.ts b/src/pages/download/styled.ts index 9d69634..569dc6a 100644 --- a/src/pages/download/styled.ts +++ b/src/pages/download/styled.ts @@ -27,6 +27,9 @@ export const DownloadFileListBoxContainer = styled.div` display: flex; flex-direction: column; align-items: center; + + margin: 0 1rem; + &::-webkit-scrollbar { display: none; }