fix: toggle

This commit is contained in:
eugene 2024-08-12 12:32:36 +03:00
parent 4c04c12403
commit 3549b6e542
2 changed files with 42 additions and 3 deletions

View File

@ -7,6 +7,7 @@ import {
isCurrentUserMarksComplete,
isCurrentValueLast
} from '../../utils'
import { useState } from 'react'
interface MarkFormFieldProps {
handleSubmit: (event: any) => void
@ -28,6 +29,7 @@ const MarkFormField = ({
currentUserMarks,
handleCurrentUserMarkChange
}: MarkFormFieldProps) => {
const [displayActions, setDisplayActions] = useState(true)
const getSubmitButtonText = () => (isReadyToSign() ? SIGN : NEXT)
const isReadyToSign = () =>
isCurrentUserMarksComplete(currentUserMarks) ||
@ -49,12 +51,28 @@ const MarkFormField = ({
? handleSubmit(event)
: handleCurrentUserMarkChange(findNext()!)
}
const toggleActions = () => setDisplayActions(!displayActions)
return (
<div className={styles.container}>
<div className={styles.trigger}>
<button></button>
<button
onClick={toggleActions}
className={styles.triggerBtn}
type="button"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="-64 0 512 512"
width="1em"
height="1em"
fill="currentColor"
transform={displayActions ? 'rotate(180)' : 'rotate(0)'}
>
<path d="M352 352c-8.188 0-16.38-3.125-22.62-9.375L192 205.3l-137.4 137.4c-12.5 12.5-32.75 12.5-45.25 0s-12.5-32.75 0-45.25l160-160c12.5-12.5 32.75-12.5 45.25 0l160 160c12.5 12.5 12.5 32.75 0 45.25C368.4 348.9 360.2 352 352 352z"></path>
</svg>
</button>
</div>
<div className={styles.actions}>
<div className={`${styles.actions} ${displayActions && styles.expanded}`}>
<div className={styles.actionsWrapper}>
<div className={styles.actionsTop}>
<div className={styles.actionsTopInfo}>

View File

@ -14,12 +14,16 @@
width: 100%;
border-radius: 4px;
padding: 10px 20px;
display: flex;
display: none;
flex-direction: column;
align-items: center;
grid-gap: 15px;
box-shadow: 0 -2px 4px 0 rgb(0,0,0,0.1);
max-width: 750px;
&.expanded {
display: flex;
}
}
.actionsWrapper {
@ -186,3 +190,20 @@ button:active {
width: 100%;
background: #4c82a3;
}
.trigger {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: relative;
}
.triggerBtn {
background: white;
color: #434343;
padding: 5px 30px;
box-shadow: 0px -3px 4px 0 rgb(0,0,0,0.1);
position: absolute;
top: -25px;
}