diff --git a/react/PointerAlert/Readme.md b/react/PointerAlert/Readme.md index c654577943..c62950bd64 100644 --- a/react/PointerAlert/Readme.md +++ b/react/PointerAlert/Readme.md @@ -17,6 +17,7 @@ import PointerAlert from 'cozy-ui/transpiled/react/PointerAlert' import AlertTitle from 'cozy-ui/transpiled/react/AlertTitle' import Button from 'cozy-ui/transpiled/react/Buttons' import Icon from 'cozy-ui/transpiled/react/Icon' +import TextField from 'cozy-ui/transpiled/react/TextField' import Variants from 'cozy-ui/docs/components/Variants' import DeviceLaptopIcon from 'cozy-ui/transpiled/react/Icons/DeviceLaptop' import DownloadIcon from 'cozy-ui/transpiled/react/Icons/Download' @@ -36,15 +37,35 @@ const initialVariants = [{ const directions = ['top', 'bottom', 'left', 'right'] +const initialState = { + position: '50%' +} +const handleChangePosition = el => { + setState({ position: el.target.value }) +} + ; {variant => ( <> +
+ +
{directions.map(direction =>
({ // position the arrow position: 'absolute', top: '-0.75rem', - left: '50%', + left: ({ position }) => position, marginLeft: '-0.75rem' }, bottom: { @@ -30,7 +30,7 @@ const useStyles = makeStyles(theme => ({ // position the arrow position: 'absolute', bottom: '-0.75rem', - left: '50%', + left: ({ position }) => position, marginLeft: '-0.75rem' }, left: { @@ -42,7 +42,7 @@ const useStyles = makeStyles(theme => ({ // position the arrow position: 'absolute', left: '-0.75rem', - top: '50%', + top: ({ position }) => position, marginTop: '-0.75rem' }, right: { @@ -54,14 +54,17 @@ const useStyles = makeStyles(theme => ({ // position the arrow position: 'absolute', right: '-0.75rem', - top: '50%', + top: ({ position }) => position, marginTop: '-0.75rem' } })) const PointerAlert = forwardRef( - ({ className, severity, children, variant, direction, ...props }, ref) => { - const styles = useStyles({ variant, severity }) + ( + { className, variant, severity, children, direction, position, ...props }, + ref + ) => { + const styles = useStyles({ variant, severity, position }) return (