Skip to content

Commit

Permalink
ui updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Lysak committed Aug 9, 2024
1 parent d60ba89 commit c720a44
Showing 1 changed file with 55 additions and 54 deletions.
109 changes: 55 additions & 54 deletions src/components/@molecules/ProfileEditor/Avatar/AvatarButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const AvatarWrapper = styled.button<{ $error?: boolean; $validated?: boolean; $d
position: relative;
width: 120px;
height: 120px;
min-width: 120px;
border-radius: 50%;
background-color: ${theme.colors.backgroundPrimary};
cursor: pointer;
Expand Down Expand Up @@ -65,7 +66,7 @@ const ActionContainer = styled.div(
display: flex;
flex-direction: column;
gap: ${theme.space[2]};
max-width: 200px;
overflow: hidden;
`,
)

Expand Down Expand Up @@ -128,62 +129,62 @@ const AvatarButton = ({
<AvatarWrapper $validated={validated && dirty} $error={error} $dirty={dirty} type="button">
<Avatar label="profile-button-avatar" src={src} noBorder />
</AvatarWrapper>
<LegacyDropdown
items={
[
{
label: t('input.profileEditor.tabs.avatar.dropdown.selectNFT'),
color: 'black',
onClick: handleSelectOption('nft'),
},
{
label: t('input.profileEditor.tabs.avatar.dropdown.uploadImage'),
color: 'black',
onClick: handleSelectOption('upload'),
},
{
label: t('input.profileEditor.tabs.avatar.dropdown.enterManually'),
color: 'black',
onClick: handleSelectOption('manual'),
},
...(validated
? [
{
label: t('action.remove', { ns: 'common' }),
color: 'red',
onClick: handleSelectOption('remove'),
},
]
: []),
] as DropdownItem[]
}
keepMenuOnTop
shortThrow
{...dropdownProps}
>
<ActionContainer>
{!!src && (
<Button disabled colorStyle="accentSecondary">
{src}
</Button>
)}
<ActionContainer>
{!!src && (
<Button disabled colorStyle="accentSecondary">
{src}
</Button>
)}
<LegacyDropdown
items={
[
{
label: t('input.profileEditor.tabs.avatar.dropdown.selectNFT'),
color: 'black',
onClick: handleSelectOption('nft'),
},
{
label: t('input.profileEditor.tabs.avatar.dropdown.uploadImage'),
color: 'black',
onClick: handleSelectOption('upload'),
},
{
label: t('input.profileEditor.tabs.avatar.dropdown.enterManually'),
color: 'black',
onClick: handleSelectOption('manual'),
},
...(validated
? [
{
label: t('action.remove', { ns: 'common' }),
color: 'red',
onClick: handleSelectOption('remove'),
},
]
: []),
] as DropdownItem[]
}
keepMenuOnTop
shortThrow
{...dropdownProps}
>
<Button colorStyle="accentSecondary">
{t('input.profileEditor.tabs.avatar.change')}
</Button>
</ActionContainer>
<input
type="file"
style={{ display: 'none' }}
accept="image/*"
ref={fileInputRef}
onChange={(e) => {
if (e.target.files?.[0]) {
onSelectOption?.('upload')
onAvatarFileChange?.(e.target.files[0])
}
}}
/>
</LegacyDropdown>
<input
type="file"
style={{ display: 'none' }}
accept="image/*"
ref={fileInputRef}
onChange={(e) => {
if (e.target.files?.[0]) {
onSelectOption?.('upload')
onAvatarFileChange?.(e.target.files[0])
}
}}
/>
</LegacyDropdown>
</ActionContainer>
</Container>
)
}
Expand Down

0 comments on commit c720a44

Please sign in to comment.