Skip to content

Commit

Permalink
Add options
Browse files Browse the repository at this point in the history
  • Loading branch information
athevinha committed Sep 18, 2024
1 parent 3fe7c7c commit faa9827
Showing 1 changed file with 49 additions and 12 deletions.
61 changes: 49 additions & 12 deletions src/sections/@dashboard/user/profile/home/ProfilePostInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
import { Button, Card, Chip, Fab, IconButton, Stack, Typography } from '@mui/material';
// components
import { useForm } from 'react-hook-form';
import FormProvider, { RHFEditor, RHFUpload } from 'src/components/hook-form';
import FormProvider, { RHFEditor, RHFSwitch, RHFUpload } from 'src/components/hook-form';
import { FormValuesProps } from 'src/sections/@dashboard/blog/BlogNewPostForm';
import Iconify from '../../../../../components/iconify';

Expand Down Expand Up @@ -54,7 +54,7 @@ export default function ProfilePostInput() {

const [openWrite, setOpenWrite] = useState<boolean>(false);
const [openMedia, setOpenMedia] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(false);
const [openOptions, setOpenOptions] = useState<boolean>(false);

const handleDrop = useCallback(
(acceptedFiles: File[]) => {
Expand All @@ -75,13 +75,14 @@ export default function ProfilePostInput() {
setValue('cover', null);
};
useEffect(() => {
if (openWrite === false) setOpenMedia(false);
if (openWrite === false) {
setOpenMedia(false);
setOpenOptions(false);
}
}, [openWrite]);
return (
<Card sx={{ p: 3 }}>
<FormProvider
methods={methods}
>
<FormProvider methods={methods}>
<Stack
spacing={1}
pb={0}
Expand All @@ -98,7 +99,8 @@ export default function ProfilePostInput() {
pb={0}
sx={{
transition: '0.4s',
...(!openMedia ? { opacity: '0', height: 0 } : { opacity: '1', height: 'wx00px' }),
position: 'relative',
...(!openMedia ? { opacity: '0', height: 0 } : { opacity: '1', height: '200px' }),
}}
>
<RHFUpload
Expand All @@ -108,17 +110,55 @@ export default function ProfilePostInput() {
onDelete={handleRemoveFile}
/>
</Stack>

<Stack
sx={{
transition: '0.4s',
position: 'relative',
...(!openOptions
? { opacity: '0', height: 0 }
: { opacity: '1', height: 'auto', paddingTop: 1, paddingBottom: 1 }),
}}
direction="column"
alignItems="left"
justifyContent="space-between"
>
<RHFSwitch
name="publish"
label="Private"
labelPlacement="start"
sx={{ mb: 0, mx: 0, width: 1, justifyContent: 'space-between' }}
/>

<RHFSwitch
name="fairlaunch"
label="Fairlaunch"
labelPlacement="start"
sx={{ mx: 0, width: 1, justifyContent: 'space-between' }}
/>

<RHFSwitch
name="derivative"
label="Community Derivative"
labelPlacement="start"
sx={{ mx: 0, width: 1, justifyContent: 'space-between' }}
/>
</Stack>

<Stack
direction="row"
alignItems="center"
justifyContent="space-between"
onFocus={() => setOpenWrite(true)}
>
<Stack direction="row" spacing={1} alignItems="left" justifyContent="space-between">
<IconButton color="primary" onClick={() => setOpenOptions(true)}>
<Iconify icon="eva:options-2-fill" width={24} />
</IconButton>
<IconButton color="success" onClick={() => setOpenMedia(true)}>
<Iconify icon="eva:image-2-fill" width={24} />
</IconButton>
<IconButton color="info" onClick={handleClickAttach}>
<IconButton color="info" onClick={() => setOpenMedia(true)}>
<Iconify icon="eva:video-fill" width={24} />
</IconButton>
<IconButton color="warning" onClick={handleClickAttach}>
Expand All @@ -127,15 +167,12 @@ export default function ProfilePostInput() {
<IconButton color="error" onClick={handleClickAttach}>
<Iconify icon="eva:pricetags-fill" width={24} />
</IconButton>
<IconButton color="primary" onClick={handleClickAttach}>
<Iconify icon="eva:smiling-face-fill" width={24} />
</IconButton>
</Stack>
<Button
color="success"
variant="soft"
onClick={() => {
reset();
reset();
}}
>
<Iconify icon="eva:edit-2-outline" pr={0.5} width={24} /> Post
Expand Down

0 comments on commit faa9827

Please sign in to comment.