button component: adds button-group component
This commit is contained in:
committed by
Johannes Kirschbauer
parent
45639c0d4f
commit
5b0334adda
@@ -0,0 +1,31 @@
|
|||||||
|
/* button DARK and states */
|
||||||
|
|
||||||
|
.button--dark {
|
||||||
|
@apply border border-solid border-secondary-950 bg-primary-800 text-white;
|
||||||
|
|
||||||
|
box-shadow: inset 1px 1px theme(backgroundColor.secondary.700);
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
@apply disabled:bg-secondary-200 disabled:text-secondary-700 disabled:border-secondary-300;
|
||||||
|
}
|
||||||
|
|
||||||
|
& .button__icon {
|
||||||
|
color: theme(textColor.secondary.200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.button--dark-hover:hover {
|
||||||
|
@apply hover:bg-secondary-900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button--dark-focus:focus {
|
||||||
|
@apply focus:border-secondary-900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button--dark-active:active {
|
||||||
|
@apply focus:border-secondary-900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button--dark-active:active {
|
||||||
|
@apply active:border-secondary-900 active:shadow-inner-primary-active;
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/* button LIGHT and states */
|
||||||
|
|
||||||
|
.button--light {
|
||||||
|
@apply border border-solid border-secondary-400 bg-secondary-100 text-secondary-950;
|
||||||
|
|
||||||
|
box-shadow: inset 1px 1px theme(backgroundColor.white);
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
@apply disabled:bg-secondary-50 disabled:text-secondary-200 disabled:border-secondary-700;
|
||||||
|
}
|
||||||
|
|
||||||
|
& .button__icon {
|
||||||
|
color: theme(textColor.secondary.900);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.button--light-hover:hover {
|
||||||
|
@apply hover:bg-secondary-200;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button--light-focus:focus {
|
||||||
|
@apply focus:bg-secondary-200;
|
||||||
|
|
||||||
|
& .button__label {
|
||||||
|
color: theme(textColor.secondary.900) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.button--light-active:active {
|
||||||
|
@apply active:bg-secondary-200 border-secondary-600 active:text-secondary-900 active:shadow-inner-primary-active;
|
||||||
|
|
||||||
|
box-shadow: inset 2px 2px theme(backgroundColor.secondary.300);
|
||||||
|
|
||||||
|
& .button__label {
|
||||||
|
color: theme(textColor.secondary.900) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
|
@import "./button-light.css";
|
||||||
|
@import "./button-dark.css";
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
@apply inline-flex items-center flex-shrink gap-1 justify-center p-4 text-secondary-950 font-semibold;
|
@apply inline-flex items-center flex-shrink gap-1 justify-center p-4 font-semibold;
|
||||||
letter-spacing: 0.0275rem;
|
letter-spacing: 0.0275rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7,88 +10,45 @@
|
|||||||
|
|
||||||
.button--default {
|
.button--default {
|
||||||
padding: theme(padding.2) theme(padding.4);
|
padding: theme(padding.2) theme(padding.4);
|
||||||
|
height: theme(height.9);
|
||||||
border-radius: theme(borderRadius.DEFAULT);
|
border-radius: theme(borderRadius.DEFAULT);
|
||||||
|
|
||||||
&:has(> .button__icon--start):has(> .button__label) {
|
&:has(> .button__icon--start):has(> .button__label) {
|
||||||
padding-left: theme(padding[2.5]);
|
padding-left: theme(padding[2.5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:has(> .button__icon--end):has(> .button__label) {
|
||||||
|
padding-right: theme(padding[2.5]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.button--small {
|
.button--small {
|
||||||
padding: theme(padding[1.5]) theme(padding[3]);
|
padding: theme(padding[1.5]) theme(padding[3]);
|
||||||
|
height: theme(height.8);
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
|
||||||
&:has(> .button__icon--start):has(> .button__label) {
|
&:has(> .button__icon--start):has(> .button__label) {
|
||||||
padding-left: theme(padding.2);
|
padding-left: theme(padding.2);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* button DARK and states */
|
&:has(> .button__icon--end):has(> .button__label) {
|
||||||
|
padding-left: theme(padding.2);
|
||||||
.button--dark {
|
|
||||||
@apply border border-solid border-secondary-950 bg-primary-800 text-white;
|
|
||||||
|
|
||||||
box-shadow: inset 1px 1px theme(backgroundColor.secondary.700);
|
|
||||||
|
|
||||||
&:disabled {
|
|
||||||
@apply disabled:bg-secondary-200 disabled:text-secondary-700 disabled:border-secondary-300;
|
|
||||||
}
|
|
||||||
|
|
||||||
& .button__icon {
|
|
||||||
color: theme(textColor.secondary.200);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.button--dark-hover:hover {
|
/* button group */
|
||||||
@apply hover:bg-secondary-900;
|
|
||||||
|
.button-group .button:first-child {
|
||||||
|
border-top-right-radius: 0;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button--dark-focus:focus {
|
.button-group .button:first-child {
|
||||||
@apply focus:border-secondary-900;
|
border-top-right-radius: 0;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button--dark-active:active {
|
.button-group .button:last-child {
|
||||||
@apply focus:border-secondary-900;
|
border-top-left-radius: 0;
|
||||||
}
|
border-bottom-left-radius: 0;
|
||||||
|
|
||||||
.button--dark-active:active {
|
|
||||||
@apply active:border-secondary-900 active:shadow-inner-primary-active;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button LIGHT and states */
|
|
||||||
|
|
||||||
.button--light {
|
|
||||||
@apply border border-solid border-secondary-400 bg-secondary-100 text-secondary-950;
|
|
||||||
|
|
||||||
box-shadow: inset 1px 1px theme(backgroundColor.white);
|
|
||||||
|
|
||||||
&:disabled {
|
|
||||||
@apply disabled:bg-secondary-50 disabled:text-secondary-200 disabled:border-secondary-700;
|
|
||||||
}
|
|
||||||
|
|
||||||
& .button__icon {
|
|
||||||
color: theme(textColor.secondary.900);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.button--light-hover:hover {
|
|
||||||
@apply hover:bg-secondary-200;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button--light-focus:focus {
|
|
||||||
@apply focus:bg-secondary-200;
|
|
||||||
|
|
||||||
& .button__label {
|
|
||||||
color: theme(textColor.secondary.900) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.button--light-active:active {
|
|
||||||
@apply active:bg-secondary-200 border-secondary-600 active:text-secondary-900 active:shadow-inner-primary-active;
|
|
||||||
|
|
||||||
box-shadow: inset 2px 2px theme(backgroundColor.secondary.300);
|
|
||||||
|
|
||||||
& .button__label {
|
|
||||||
color: theme(textColor.secondary.900) !important;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ export const Button = (props: ButtonProps) => {
|
|||||||
{...other}
|
{...other}
|
||||||
>
|
>
|
||||||
{local.startIcon && (
|
{local.startIcon && (
|
||||||
<span class="button__icon--start h-4">{local.startIcon}</span>
|
<span class="button__icon--start">{local.startIcon}</span>
|
||||||
)}
|
)}
|
||||||
{local.children && (
|
{local.children && (
|
||||||
<Typography
|
<Typography
|
||||||
@@ -94,7 +94,9 @@ export const Button = (props: ButtonProps) => {
|
|||||||
{local.children}
|
{local.children}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
{local.endIcon && <span class="h-4">{local.endIcon}</span>}
|
{local.endIcon && (
|
||||||
|
<span class="button__icon--start">{local.endIcon}</span>
|
||||||
|
)}
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -82,37 +82,31 @@ export const MachineListView: Component = () => {
|
|||||||
size="s"
|
size="s"
|
||||||
onClick={() => refresh()}
|
onClick={() => refresh()}
|
||||||
startIcon={<Icon icon="Update" />}
|
startIcon={<Icon icon="Update" />}
|
||||||
></Button>
|
/>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div class="border border-def-3">
|
<div class="button-group">
|
||||||
<span class="" data-tip="List View">
|
|
||||||
<Button
|
|
||||||
onclick={() => setView("list")}
|
|
||||||
variant={view() == "list" ? "dark" : "light"}
|
|
||||||
size="s"
|
|
||||||
startIcon={<Icon icon="List" />}
|
|
||||||
></Button>
|
|
||||||
</span>
|
|
||||||
<span class="" data-tip="Grid View">
|
|
||||||
<Button
|
|
||||||
onclick={() => setView("grid")}
|
|
||||||
variant={view() == "grid" ? "dark" : "light"}
|
|
||||||
size="s"
|
|
||||||
startIcon={<Icon icon="Grid" />}
|
|
||||||
></Button>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<span class="" data-tip="New Machine">
|
|
||||||
<Button
|
<Button
|
||||||
onClick={() => navigate("create")}
|
onclick={() => setView("list")}
|
||||||
|
variant={view() == "list" ? "dark" : "light"}
|
||||||
size="s"
|
size="s"
|
||||||
variant="light"
|
startIcon={<Icon icon="List" />}
|
||||||
startIcon={<Icon icon="Plus" />}
|
/>
|
||||||
>
|
<Button
|
||||||
New Machine
|
onclick={() => setView("grid")}
|
||||||
</Button>
|
variant={view() == "grid" ? "dark" : "light"}
|
||||||
</span>
|
size="s"
|
||||||
|
startIcon={<Icon icon="Grid" />}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
onClick={() => navigate("create")}
|
||||||
|
size="s"
|
||||||
|
variant="light"
|
||||||
|
startIcon={<Icon size={14} icon="Plus" />}
|
||||||
|
>
|
||||||
|
New Machine
|
||||||
|
</Button>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -113,38 +113,33 @@ export const ModuleList = () => {
|
|||||||
title="Modules"
|
title="Modules"
|
||||||
toolbar={
|
toolbar={
|
||||||
<>
|
<>
|
||||||
<span class="" data-tip="Reload">
|
<Button
|
||||||
<Button
|
variant="light"
|
||||||
variant="light"
|
size="s"
|
||||||
size="s"
|
onClick={() => refresh()}
|
||||||
onClick={() => refresh()}
|
startIcon={<Icon icon="Update" />}
|
||||||
startIcon={<Icon icon="Update" />}
|
/>
|
||||||
></Button>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<div class="border border-def-3">
|
<div class="button-group">
|
||||||
<span class="" data-tip="List View">
|
<Button
|
||||||
<Button
|
onclick={() => setView("list")}
|
||||||
onclick={() => setView("list")}
|
variant={view() == "list" ? "dark" : "light"}
|
||||||
variant={view() == "list" ? "dark" : "light"}
|
size="s"
|
||||||
size="s"
|
startIcon={<Icon icon="List" />}
|
||||||
startIcon={<Icon icon="List" />}
|
/>
|
||||||
></Button>
|
|
||||||
</span>
|
<Button
|
||||||
<span class="" data-tip="Grid View">
|
onclick={() => setView("grid")}
|
||||||
<Button
|
variant={view() == "grid" ? "dark" : "light"}
|
||||||
onclick={() => setView("grid")}
|
size="s"
|
||||||
variant={view() == "grid" ? "dark" : "light"}
|
startIcon={<Icon icon="Grid" />}
|
||||||
size="s"
|
/>
|
||||||
startIcon={<Icon icon="Grid" />}
|
|
||||||
></Button>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
<span class="" data-tip="New Machine">
|
<span class="" data-tip="New Machine">
|
||||||
<Button
|
<Button
|
||||||
size="s"
|
size="s"
|
||||||
variant="light"
|
variant="light"
|
||||||
startIcon={<Icon icon="CaretUp" />}
|
startIcon={<Icon size={14} icon="CaretUp" />}
|
||||||
>
|
>
|
||||||
Import Module
|
Import Module
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user