From 05b924837594ee0614ae7769f164d48fd084f1c4 Mon Sep 17 00:00:00 2001 From: enes Date: Tue, 20 Aug 2024 11:46:24 +0200 Subject: [PATCH] refactor(create-page): users design update --- src/components/FileList/style.module.scss | 14 +-- src/components/UserAvatar/styles.module.scss | 4 + src/pages/create/index.tsx | 98 ++++++++++++++------ src/pages/create/style.module.scss | 9 +- 4 files changed, 88 insertions(+), 37 deletions(-) diff --git a/src/components/FileList/style.module.scss b/src/components/FileList/style.module.scss index 6f7b64a..9a379ea 100644 --- a/src/components/FileList/style.module.scss +++ b/src/components/FileList/style.module.scss @@ -17,8 +17,8 @@ ul { list-style-type: none; /* Removes bullet points */ - margin: 0; /* Removes default margin */ - padding: 0; /* Removes default padding */ + margin: 0; /* Removes default margin */ + padding: 0; /* Removes default padding */ } li { @@ -27,7 +27,6 @@ li { padding: 0; /* Removes any default padding */ } - .wrap { display: flex; flex-direction: column; @@ -50,7 +49,7 @@ li { } .files::-webkit-scrollbar-track { - background-color: rgba(0,0,0,0.15); + background-color: rgba(0, 0, 0, 0.15); } .files::-webkit-scrollbar-thumb { @@ -70,12 +69,12 @@ li { background: #ffffff; padding: 5px 10px; align-items: center; - color: rgba(0,0,0,0.5); + color: rgba(0, 0, 0, 0.5); cursor: pointer; flex-grow: 1; font-size: 16px; font-weight: 500; - + min-height: 45px; &.active { background: #4c82a3; @@ -100,6 +99,7 @@ li { -webkit-box-orient: vertical; overflow: hidden; -webkit-line-clamp: 1; + line-clamp: 1; } .fileNumber { @@ -120,4 +120,4 @@ li { align-items: center; height: 25px; width: 25px; -} \ No newline at end of file +} diff --git a/src/components/UserAvatar/styles.module.scss b/src/components/UserAvatar/styles.module.scss index fbe8cf5..d57cdf1 100644 --- a/src/components/UserAvatar/styles.module.scss +++ b/src/components/UserAvatar/styles.module.scss @@ -10,4 +10,8 @@ font-weight: 500; font-size: 14px; color: var(--text-color); + + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; } diff --git a/src/pages/create/index.tsx b/src/pages/create/index.tsx index 970e001..35780cb 100644 --- a/src/pages/create/index.tsx +++ b/src/pages/create/index.tsx @@ -1,8 +1,6 @@ -import { DragHandle } from '@mui/icons-material' import { Button, - IconButton, - ListItem, + FormHelperText, ListItemIcon, ListItemText, MenuItem, @@ -60,6 +58,7 @@ import { StickySideColumns } from '../../layouts/StickySideColumns.tsx' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faEye, + faGripLines, faPen, faPlus, faTrash, @@ -89,6 +88,12 @@ export const CreatePage = () => { } const [userInput, setUserInput] = useState('') + const handleInputKeyDown = (event: React.KeyboardEvent) => { + if (event.code === 'Enter' || event.code === 'NumpadEnter') { + event.preventDefault() + handleAddUser() + } + } const [userRole, setUserRole] = useState(UserRole.signer) const [error, setError] = useState() @@ -783,7 +788,7 @@ export const CreatePage = () => { placeholder="User (nip05 / npub)" value={userInput} onChange={(e) => setUserInput(e.target.value)} - helperText={error} + onKeyDown={handleInputKeyDown} error={!!error} fullWidth sx={{ @@ -804,6 +809,7 @@ export const CreatePage = () => { IconComponent={() => null} renderValue={(value) => ( )} @@ -818,20 +824,16 @@ export const CreatePage = () => { }} > - - - - - {UserRole.signer} - + + + + {UserRole.signer} - - - - - - {UserRole.viewer} - + + + + + {UserRole.viewer} + + {!!error && ( + {error} + )} } > @@ -934,6 +940,8 @@ const DisplayUser = ({ IconComponent={() => null} renderValue={(value) => ( )} @@ -942,9 +950,12 @@ const DisplayUser = ({ } sx={{ fontSize: '16px', - minWidth: '44px', + minWidth: '34px', + maxWidth: '34px', + minHeight: '34px', + maxHeight: '34px', '& .MuiInputBase-input': { - padding: '7px 14px!important', + padding: '10px !important', textOverflow: 'unset!important' }, '& .MuiOutlinedInput-notchedOutline': { @@ -956,9 +967,20 @@ const DisplayUser = ({ {UserRole.viewer} - handleRemoveUser(user.pubkey)}> - - + ) @@ -1073,7 +1095,7 @@ const SignerRow = ({ data-handler-id={handlerId} ref={ref} > - +
null} renderValue={(value) => ( - + )} onChange={(e) => handleUserRoleChange(e.target.value as UserRole, user.pubkey) } sx={{ fontSize: '16px', - minWidth: '44px', + minWidth: '34px', + maxWidth: '34px', + minHeight: '34px', + maxHeight: '34px', '& .MuiInputBase-input': { - padding: '7px 14px!important', + padding: '10px !important', textOverflow: 'unset!important' }, '& .MuiOutlinedInput-notchedOutline': { @@ -1112,9 +1141,20 @@ const SignerRow = ({ {UserRole.viewer} - handleRemoveUser(user.pubkey)}> - - +
) diff --git a/src/pages/create/style.module.scss b/src/pages/create/style.module.scss index b47e2f3..e85323d 100644 --- a/src/pages/create/style.module.scss +++ b/src/pages/create/style.module.scss @@ -104,9 +104,16 @@ .avatar { flex-grow: 1; + min-width: 0; &:first-child { - margin-left: 34px; + margin-left: 24px; + } + + img { + // Override the default avatar size + width: 30px; + height: 30px; } }