Skip to content

Commit

Permalink
Setup select element
Browse files Browse the repository at this point in the history
  • Loading branch information
Comeza committed Jun 20, 2024
1 parent ed06848 commit 0f2847a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
Binary file modified liberica/bun.lockb
Binary file not shown.
21 changes: 19 additions & 2 deletions liberica/src/components/lila/select.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
export type SelectProps = Omit<React.ComponentProps<"select">, "className">;
import { classes } from "components/lila";

export type SelectProps = Omit<
React.ComponentProps<"select">,
"className" | "size"
> &
SelectPropsExt;
export interface SelectPropsExt {
size?: keyof typeof INPUT_SIZES;
noLogo?: boolean;
}

export const BASE =
"text-on-muted rounded-xl bg-muted/20 outline-none ring-muted focus:ring-2";

export const INPUT_SIZES = {
lg: "px-6 py-3 text-md",
};

export function Select(props: SelectProps) {
return (
<select className="text-text rounded-xl bg-muted/20 px-6 py-3">
<select className={classes(BASE, INPUT_SIZES[props.size ?? "lg"])}>
{props.children}
</select>
);
Expand Down
8 changes: 5 additions & 3 deletions liberica/src/page/Debug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ButtonVariant,
} from "components/lila/button";
import { TextInput } from "components/lila/input";
import { Select } from "components/lila/select";
import { THEMES, ThemeName, applyTheme } from "lib/theme";
import { useState } from "react";

Expand All @@ -19,9 +20,10 @@ export function Debug() {
<TextInput
placeholder="Enter example text"
onChange={(e) => setText(e.target.value || "Test")}
></TextInput>
/>

<select
<Select
size="lg"
onChange={(e) =>
applyTheme(e.target.value as ThemeName, {
broadcast: true,
Expand All @@ -32,7 +34,7 @@ export function Debug() {
{Object.keys(THEMES).map((theme) => (
<option key={theme}>{theme}</option>
))}
</select>
</Select>

<table className="table-auto border-spacing-2">
<thead>
Expand Down

0 comments on commit 0f2847a

Please sign in to comment.