Updated AccountModal
This commit is contained in:
parent
378486954c
commit
7c1b97d4ad
2 changed files with 38 additions and 40 deletions
|
|
@ -1,9 +1,12 @@
|
||||||
.Account.DialogContent {
|
.fields {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: $unit-2x;
|
gap: $unit-2x;
|
||||||
width: $unit * 64;
|
padding: 0 $unit-4x;
|
||||||
overflow-y: hidden;
|
|
||||||
|
@include breakpoint(phone) {
|
||||||
|
gap: $unit-4x;
|
||||||
|
}
|
||||||
|
|
||||||
.DialogDescription {
|
.DialogDescription {
|
||||||
font-size: $font-regular;
|
font-size: $font-regular;
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,9 @@ import { useRouter } from 'next/router'
|
||||||
import { useTranslation } from 'next-i18next'
|
import { useTranslation } from 'next-i18next'
|
||||||
import { useTheme } from 'next-themes'
|
import { useTheme } from 'next-themes'
|
||||||
|
|
||||||
import {
|
import { Dialog } from '~components/common/Dialog'
|
||||||
Dialog,
|
import DialogHeader from '~components/common/DialogHeader'
|
||||||
DialogClose,
|
import DialogFooter from '~components/common/DialogFooter'
|
||||||
DialogTitle,
|
|
||||||
DialogTrigger,
|
|
||||||
} from '~components/common/Dialog'
|
|
||||||
import DialogContent from '~components/common/DialogContent'
|
import DialogContent from '~components/common/DialogContent'
|
||||||
import Button from '~components/common/Button'
|
import Button from '~components/common/Button'
|
||||||
import SelectItem from '~components/common/SelectItem'
|
import SelectItem from '~components/common/SelectItem'
|
||||||
|
|
@ -197,17 +194,20 @@ const AccountModal = React.forwardRef<HTMLDivElement, Props>(
|
||||||
.sort((a, b) => (a.name.en > b.name.en ? 1 : -1))
|
.sort((a, b) => (a.name.en > b.name.en ? 1 : -1))
|
||||||
.map((item, i) => {
|
.map((item, i) => {
|
||||||
return (
|
return (
|
||||||
<PictureSelectItem
|
<SelectItem
|
||||||
key={`picture-${i}`}
|
key={`picture-${i}`}
|
||||||
element={item.element}
|
element={item.element}
|
||||||
src={[
|
icon={{
|
||||||
`/profile/${item.filename}.png`,
|
alt: item.name[locale],
|
||||||
`/profile/${item.filename}@2x.png 2x`,
|
src: [
|
||||||
]}
|
`/profile/${item.filename}.png`,
|
||||||
|
`/profile/${item.filename}@2x.png 2x`,
|
||||||
|
],
|
||||||
|
}}
|
||||||
value={item.filename}
|
value={item.filename}
|
||||||
>
|
>
|
||||||
{item.name[locale]}
|
{item.name[locale]}
|
||||||
</PictureSelectItem>
|
</SelectItem>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -215,15 +215,17 @@ const AccountModal = React.forwardRef<HTMLDivElement, Props>(
|
||||||
<SelectTableField
|
<SelectTableField
|
||||||
name="picture"
|
name="picture"
|
||||||
description={t('modals.settings.descriptions.picture')}
|
description={t('modals.settings.descriptions.picture')}
|
||||||
className="Image"
|
className="image"
|
||||||
label={t('modals.settings.labels.picture')}
|
label={t('modals.settings.labels.picture')}
|
||||||
|
image={{
|
||||||
|
className: pictureData.find((i) => i.filename === picture)?.element,
|
||||||
|
src: [`/profile/${picture}.png`, `/profile/${picture}@2x.png 2x`],
|
||||||
|
alt: pictureData.find((i) => i.filename === picture)?.name[locale],
|
||||||
|
}}
|
||||||
open={pictureOpen}
|
open={pictureOpen}
|
||||||
onOpenChange={() => openSelect('picture')}
|
onOpenChange={() => openSelect('picture')}
|
||||||
onChange={handlePictureChange}
|
onChange={handlePictureChange}
|
||||||
onClose={() => setPictureOpen(false)}
|
onClose={() => setPictureOpen(false)}
|
||||||
imageAlt={t('modals.settings.labels.image_alt')}
|
|
||||||
imageClass={pictureData.find((i) => i.filename === picture)?.element}
|
|
||||||
imageSrc={[`/profile/${picture}.png`, `/profile/${picture}@2x.png 2x`]}
|
|
||||||
value={picture}
|
value={picture}
|
||||||
>
|
>
|
||||||
{pictureOptions}
|
{pictureOptions}
|
||||||
|
|
@ -308,36 +310,29 @@ const AccountModal = React.forwardRef<HTMLDivElement, Props>(
|
||||||
onOpenAutoFocus={(event: Event) => {}}
|
onOpenAutoFocus={(event: Event) => {}}
|
||||||
onEscapeKeyDown={onEscapeKeyDown}
|
onEscapeKeyDown={onEscapeKeyDown}
|
||||||
>
|
>
|
||||||
<div className="DialogHeader" ref={headerRef}>
|
<DialogHeader
|
||||||
<div className="DialogTop">
|
title={`@${username}`}
|
||||||
<DialogTitle className="SubTitle">
|
subtitle={t('modals.settings.title')}
|
||||||
{t('modals.settings.title')}
|
/>
|
||||||
</DialogTitle>
|
|
||||||
<DialogTitle className="DialogTitle">@{username}</DialogTitle>
|
|
||||||
</div>
|
|
||||||
<DialogClose className="DialogClose" asChild>
|
|
||||||
<span>
|
|
||||||
<CrossIcon />
|
|
||||||
</span>
|
|
||||||
</DialogClose>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form onSubmit={update}>
|
<form onSubmit={update}>
|
||||||
<div className="Fields">
|
<div className={styles.fields}>
|
||||||
{pictureField()}
|
{pictureField()}
|
||||||
{genderField()}
|
{genderField()}
|
||||||
{languageField()}
|
{languageField()}
|
||||||
{themeField()}
|
{themeField()}
|
||||||
</div>
|
</div>
|
||||||
<div className="DialogFooter" ref={footerRef}>
|
|
||||||
<div className="Left"></div>
|
<DialogFooter
|
||||||
<div className="Right">
|
ref={footerRef}
|
||||||
|
rightElements={[
|
||||||
<Button
|
<Button
|
||||||
contained={true}
|
bound={true}
|
||||||
|
key="confirm"
|
||||||
text={t('modals.settings.buttons.confirm')}
|
text={t('modals.settings.buttons.confirm')}
|
||||||
/>
|
/>,
|
||||||
</div>
|
]}
|
||||||
</div>
|
/>
|
||||||
</form>
|
</form>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue