1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-24 17:51:14 +02:00
unleash.unleash/frontend/src/component/playground/Playground/PlaygroundGuidancePopper/PlaygroundGuidancePopper.tsx
Tymoteusz Czech 859aa435e0 Refine Playground UI (#1217)
* fix playground border radius consistency

* improve playground alerts

* fix: playground segments constraint type logic

* fix: refactor segment execution

* fix: comments

* fix: add summary width

* align playground spacing and borders

* fix build - ts segment type in playground

* fix status cell logic

* update playground disabled env info

* fix playground filter by status and sort

Co-authored-by: Nuno Góis <github@nunogois.com>

Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
Co-authored-by: andreas-unleash <104830839+andreas-unleash@users.noreply.github.com>
Co-authored-by: Nuno Góis <github@nunogois.com>
2022-08-12 10:13:07 +00:00

50 lines
1.5 KiB
TypeScript

import { useState } from 'react';
import { Close, Help } from '@mui/icons-material';
import { Box, IconButton, Popper, Paper } from '@mui/material';
import { PlaygroundGuidance } from '../PlaygroundGuidance/PlaygroundGuidance';
export const PlaygroundGuidancePopper = () => {
const [anchor, setAnchorEl] = useState<null | Element>(null);
const onOpen = (event: React.FormEvent<HTMLButtonElement>) =>
setAnchorEl(event.currentTarget);
const onClose = () => setAnchorEl(null);
const open = Boolean(anchor);
const id = 'playground-guidance-popper';
return (
<Box>
<IconButton onClick={onOpen} aria-describedby={id}>
<Help />
</IconButton>
<Popper
id={id}
open={open}
anchorEl={anchor}
sx={theme => ({ zIndex: theme.zIndex.tooltip })}
>
<Paper
sx={theme => ({
padding: theme.spacing(8, 4),
maxWidth: '500px',
borderRadius: `${theme.shape.borderRadiusExtraLarge}px`,
})}
>
<IconButton
onClick={onClose}
sx={{ position: 'absolute', right: 25, top: 15 }}
>
<Close />
</IconButton>
<PlaygroundGuidance />
</Paper>
</Popper>
</Box>
);
};