fix: toggle
This commit is contained in:
parent
4c04c12403
commit
3549b6e542
@ -7,6 +7,7 @@ import {
|
|||||||
isCurrentUserMarksComplete,
|
isCurrentUserMarksComplete,
|
||||||
isCurrentValueLast
|
isCurrentValueLast
|
||||||
} from '../../utils'
|
} from '../../utils'
|
||||||
|
import { useState } from 'react'
|
||||||
|
|
||||||
interface MarkFormFieldProps {
|
interface MarkFormFieldProps {
|
||||||
handleSubmit: (event: any) => void
|
handleSubmit: (event: any) => void
|
||||||
@ -28,6 +29,7 @@ const MarkFormField = ({
|
|||||||
currentUserMarks,
|
currentUserMarks,
|
||||||
handleCurrentUserMarkChange
|
handleCurrentUserMarkChange
|
||||||
}: MarkFormFieldProps) => {
|
}: MarkFormFieldProps) => {
|
||||||
|
const [displayActions, setDisplayActions] = useState(true)
|
||||||
const getSubmitButtonText = () => (isReadyToSign() ? SIGN : NEXT)
|
const getSubmitButtonText = () => (isReadyToSign() ? SIGN : NEXT)
|
||||||
const isReadyToSign = () =>
|
const isReadyToSign = () =>
|
||||||
isCurrentUserMarksComplete(currentUserMarks) ||
|
isCurrentUserMarksComplete(currentUserMarks) ||
|
||||||
@ -49,12 +51,28 @@ const MarkFormField = ({
|
|||||||
? handleSubmit(event)
|
? handleSubmit(event)
|
||||||
: handleCurrentUserMarkChange(findNext()!)
|
: handleCurrentUserMarkChange(findNext()!)
|
||||||
}
|
}
|
||||||
|
const toggleActions = () => setDisplayActions(!displayActions)
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<div className={styles.trigger}>
|
<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>
|
||||||
<div className={styles.actions}>
|
<div className={`${styles.actions} ${displayActions && styles.expanded}`}>
|
||||||
<div className={styles.actionsWrapper}>
|
<div className={styles.actionsWrapper}>
|
||||||
<div className={styles.actionsTop}>
|
<div className={styles.actionsTop}>
|
||||||
<div className={styles.actionsTopInfo}>
|
<div className={styles.actionsTopInfo}>
|
||||||
|
@ -14,12 +14,16 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
display: flex;
|
display: none;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
grid-gap: 15px;
|
grid-gap: 15px;
|
||||||
box-shadow: 0 -2px 4px 0 rgb(0,0,0,0.1);
|
box-shadow: 0 -2px 4px 0 rgb(0,0,0,0.1);
|
||||||
max-width: 750px;
|
max-width: 750px;
|
||||||
|
|
||||||
|
&.expanded {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.actionsWrapper {
|
.actionsWrapper {
|
||||||
@ -186,3 +190,20 @@ button:active {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
background: #4c82a3;
|
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;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user