cleaned up options styles

This commit is contained in:
ari committed 2022-06-29 16:34:59 -04:00
1 parent 4d9afbe26b
commit 0088dd8448
11 files changed
+106 -104

No files matched your search

+8 -9
View File
@@ -18,6 +18,7 @@
.speed-dial--list.close {
width: 0;
opacity: 0;
display: none;
}
.speed-dial--list {
@@ -29,17 +30,15 @@
border-radius: 10px;
}
.speed-dial--list.row {
.speed-dial--list.open {
display: flex;
flex-direction: row;
top: 0;
left: 2em;
}
.speed-dial--list.column {
display: flex;
flex-direction: column;
gap: 0.25em;
top: 2em;
left: 0.25em;
.speed-dial--list.right {
left: 2em
}
.speed-dial--list.left {
right: 3em
}
+4 -3
View File
@@ -1,16 +1,17 @@
import "./index.css";
import { FC, ReactNode, useState } from "react";
import { FC, ReactNode, useRef, useState } from "react";
import ClickAwayListener from "@mui/material/ClickAwayListener";
export type SpeedDialProps = {
icon: ReactNode;
className?: string;
children: ReactNode;
direction?: "row" | "column";
direction?: "left" | "right";
};
export const SpeedDial: FC<SpeedDialProps> = (props) => {
const [open, setOpen] = useState(false);
const direction = props.direction ?? "right";
return (
<ClickAwayListener onClickAway={() => setOpen(false)}>
<div
@@ -26,7 +27,7 @@ export const SpeedDial: FC<SpeedDialProps> = (props) => {
className={[
"speed-dial--list",
open ? "open" : "close",
props.direction ?? "row",
direction,
].join(" ")}
>
{props.children}