Skip to content

Commit

Permalink
Custom panel header
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszmigas committed Mar 2, 2024
1 parent bd1bf3b commit b790504
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 10 deletions.
3 changes: 2 additions & 1 deletion apps/web/src/components/appContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ResizablePanelGroup,
} from "@/components/ui/resizable";
import { SelectToolPanel } from "./panels/selectToolPanel";
import { ColorsPanel } from "./panels/colorsPanel";

const LeftContent = () => {
return (
Expand All @@ -13,7 +14,7 @@ const LeftContent = () => {
</ResizablePanel>
<ResizableHandle />
<ResizablePanel defaultSize={30}>
<div className="p-2">Colors</div>
<ColorsPanel />
</ResizablePanel>
</ResizablePanelGroup>
);
Expand Down
1 change: 0 additions & 1 deletion apps/web/src/components/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export const Icon = (props: {
type: IconType;
size: IconSize;
className?: string;
// onClick
}) => {
const { type, size, className } = props;
return renderLucideIcon(type, size, className);
Expand Down
12 changes: 12 additions & 0 deletions apps/web/src/components/panels/colorsPanel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { translations } from "@/translations";
import { PanelHeader } from "./panelHeader";

export const ColorsPanel = () => {
return (
<div className="flex flex-col gap-medium">
<PanelHeader title={translations.colors} />
<div className="flex flex-wrap flex-row gap-small p-small"></div>
</div>
);
};

6 changes: 1 addition & 5 deletions apps/web/src/components/panels/panelHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
export const PanelHeader = (props: { title: string }) => {
const { title } = props;
return (
<div>
<h2>{title}</h2>
</div>
);
return <div className="bg-secondary p-small">{title}</div>;
};

4 changes: 2 additions & 2 deletions apps/web/src/components/panels/selectToolPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export const SelectToolPanel = () => {
(state) => state
);
return (
<div className="p-2 flex flex-col gap-2">
<div className="flex flex-col gap-medium">
<PanelHeader title={translations.tools} />
<div className="flex flex-wrap flex-row gap-1">
<div className="flex flex-wrap flex-row gap-small p-small">
{tools.map((tool) => (
<IconButton
className={selectedTool === tool ? "bg-accent" : ""}
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/translations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const translations = {
tools: "Tools",
colors: "Colors",
};

14 changes: 13 additions & 1 deletion apps/web/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
/** @type {import('tailwindcss').Config} */

const space = {
["very-small"]: "0.125rem",
small: "0.25rem",
medium: "0.5rem",
huge: "1rem",
};


module.exports = {
darkMode: ["class"],
content: [
Expand All @@ -17,6 +26,9 @@ module.exports = {
},
},
extend: {
gap: space,
margin: space,
padding: space,
colors: {
border: "hsl(var(--border))",
input: "hsl(var(--input))",
Expand Down Expand Up @@ -74,4 +86,4 @@ module.exports = {
},
},
plugins: [require("tailwindcss-animate")],
}
};

0 comments on commit b790504

Please sign in to comment.