2023-09-12 13:45:36 +00:00
|
|
|
import React from "react";
|
|
|
|
|
2023-09-25 13:47:40 +00:00
|
|
|
// ui
|
|
|
|
import { Tooltip } from "components/ui";
|
2023-09-25 07:54:23 +00:00
|
|
|
// types
|
|
|
|
import { TIssueLayouts } from "types";
|
|
|
|
// constants
|
|
|
|
import { ISSUE_LAYOUTS } from "constants/issue";
|
2023-09-12 13:45:36 +00:00
|
|
|
|
2023-09-25 07:54:23 +00:00
|
|
|
type Props = {
|
|
|
|
layouts: TIssueLayouts[];
|
|
|
|
onChange: (layout: TIssueLayouts) => void;
|
|
|
|
selectedLayout: TIssueLayouts;
|
|
|
|
};
|
2023-09-12 13:45:36 +00:00
|
|
|
|
2023-09-25 07:54:23 +00:00
|
|
|
export const LayoutSelection: React.FC<Props> = (props) => {
|
|
|
|
const { layouts, onChange, selectedLayout } = props;
|
2023-09-14 09:11:41 +00:00
|
|
|
|
2023-09-12 13:45:36 +00:00
|
|
|
return (
|
2023-09-25 07:54:23 +00:00
|
|
|
<div className="flex items-center gap-1 p-1 rounded bg-custom-background-80">
|
|
|
|
{ISSUE_LAYOUTS.filter((l) => layouts.includes(l.key)).map((layout) => (
|
2023-09-28 09:46:24 +00:00
|
|
|
<Tooltip key={layout.key} tooltipContent={layout.title}>
|
2023-09-25 13:47:40 +00:00
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
className={`w-7 h-[22px] rounded grid place-items-center transition-all hover:bg-custom-background-100 overflow-hidden group ${
|
|
|
|
selectedLayout == layout.key ? "bg-custom-background-100 shadow-custom-shadow-2xs" : ""
|
|
|
|
}`}
|
|
|
|
onClick={() => onChange(layout.key)}
|
|
|
|
>
|
|
|
|
<layout.icon
|
|
|
|
size={14}
|
|
|
|
strokeWidth={2}
|
|
|
|
className={`${selectedLayout == layout.key ? "text-custom-text-100" : "text-custom-text-200"}`}
|
|
|
|
/>
|
|
|
|
</button>
|
|
|
|
</Tooltip>
|
2023-09-25 07:54:23 +00:00
|
|
|
))}
|
2023-09-12 13:45:36 +00:00
|
|
|
</div>
|
|
|
|
);
|
2023-09-25 07:54:23 +00:00
|
|
|
};
|