ui/toolbar: use css modules

This commit is contained in:
Johannes Kirschbauer
2025-07-29 19:10:42 +02:00
parent 6e71b541aa
commit 9954653657
4 changed files with 14 additions and 34 deletions

View File

@@ -1,4 +1,4 @@
div.toolbar { .toolbar {
@apply flex flex-row items-center justify-center gap-1.5 p-1 size-fit rounded-md self-stretch; @apply flex flex-row items-center justify-center gap-1.5 p-1 size-fit rounded-md self-stretch;
border: 0.0625rem solid theme(colors.off.toolbar_border); border: 0.0625rem solid theme(colors.off.toolbar_border);
@@ -13,7 +13,7 @@ div.toolbar {
} }
} }
button.toolbar-button { .toolbar_button {
@apply w-6 h-6 p-1 rounded-[0.25rem]; @apply w-6 h-6 p-1 rounded-[0.25rem];
&:hover { &:hover {

View File

@@ -43,13 +43,8 @@ export const WithTooltip: Story = {
trigger={<ToolbarButton name="select" icon="Cursor" />} trigger={<ToolbarButton name="select" icon="Cursor" />}
placement="top" placement="top"
> >
<div class="p-1 mb-1"> <div class="p-1 mb-1 text-fg-inv-1">
<Typography <Typography hierarchy="label" size="s" color="inherit">
hierarchy="label"
size="s"
color="inherit"
class="text-fg-inv-1"
>
Select an object Select an object
</Typography> </Typography>
</div> </div>
@@ -59,13 +54,8 @@ export const WithTooltip: Story = {
trigger={<ToolbarButton name="new-machine" icon="NewMachine" />} trigger={<ToolbarButton name="new-machine" icon="NewMachine" />}
placement="top" placement="top"
> >
<div class="p-1 mb-1"> <div class="p-1 mb-1 text-fg-inv-1">
<Typography <Typography hierarchy="label" size="s" color="inherit">
hierarchy="label"
size="s"
color="inherit"
class="text-fg-inv-1"
>
Create a new machine Create a new machine
</Typography> </Typography>
</div> </div>
@@ -76,13 +66,8 @@ export const WithTooltip: Story = {
} }
placement="top" placement="top"
> >
<div class="p-1 mb-1"> <div class="p-1 mb-1 text-fg-inv-1">
<Typography <Typography hierarchy="label" size="s" color="inherit">
hierarchy="label"
size="s"
color="inherit"
class="text-fg-inv-1"
>
Manage Services Manage Services
</Typography> </Typography>
</div> </div>
@@ -91,13 +76,8 @@ export const WithTooltip: Story = {
trigger={<ToolbarButton name="ai" icon="AI" />} trigger={<ToolbarButton name="ai" icon="AI" />}
placement="top" placement="top"
> >
<div class="p-1 mb-1"> <div class="p-1 mb-1 text-fg-inv-1">
<Typography <Typography hierarchy="label" size="s" color="inherit">
hierarchy="label"
size="s"
color="inherit"
class="text-fg-inv-1"
>
Chat with AI Chat with AI
</Typography> </Typography>
</div> </div>

View File

@@ -1,5 +1,5 @@
import "./Toolbar.css";
import { JSX } from "solid-js"; import { JSX } from "solid-js";
import styles from "./Toolbar.module.css";
export interface ToolbarProps { export interface ToolbarProps {
children: JSX.Element; children: JSX.Element;
@@ -7,7 +7,7 @@ export interface ToolbarProps {
export const Toolbar = (props: ToolbarProps) => { export const Toolbar = (props: ToolbarProps) => {
return ( return (
<div class="toolbar" role="toolbar" aria-orientation="horizontal"> <div class={styles.toolbar} role="toolbar" aria-orientation="horizontal">
{props.children} {props.children}
</div> </div>
); );

View File

@@ -1,4 +1,4 @@
import "./Toolbar.css"; import styles from "./Toolbar.module.css";
import cx from "classnames"; import cx from "classnames";
import { Button } from "@kobalte/core/button"; import { Button } from "@kobalte/core/button";
import Icon, { IconVariant } from "@/src/components/Icon/Icon"; import Icon, { IconVariant } from "@/src/components/Icon/Icon";
@@ -13,7 +13,7 @@ export interface ToolbarButtonProps
export const ToolbarButton = (props: ToolbarButtonProps) => { export const ToolbarButton = (props: ToolbarButtonProps) => {
return ( return (
<Button <Button
class={cx("toolbar-button", { selected: props.selected })} class={cx(styles.toolbar_button, { selected: props.selected })}
{...props} {...props}
> >
<Icon icon={props.icon} inverted={!props.selected} /> <Icon icon={props.icon} inverted={!props.selected} />