Merge branch 'main' into update-assistant-styles

This commit is contained in:
Nate Butler
2023-07-10 10:22:18 -04:00
140 changed files with 4100 additions and 1106 deletions
+12 -13
View File
@@ -1,6 +1,6 @@
import { interactive, toggleable } from "../element"
import { background, foreground } from "../style_tree/components"
import { ColorScheme } from "../theme/color_scheme"
import { useTheme, Theme } from "../theme"
export type Margin = {
top: number
@@ -11,21 +11,20 @@ export type Margin = {
interface IconButtonOptions {
layer?:
| ColorScheme["lowest"]
| ColorScheme["middle"]
| ColorScheme["highest"]
color?: keyof ColorScheme["lowest"]
| Theme["lowest"]
| Theme["middle"]
| Theme["highest"]
color?: keyof Theme["lowest"]
margin?: Partial<Margin>
}
type ToggleableIconButtonOptions = IconButtonOptions & {
active_color?: keyof ColorScheme["lowest"]
active_color?: keyof Theme["lowest"]
}
export function icon_button(
theme: ColorScheme,
{ color, margin, layer }: IconButtonOptions
) {
export function icon_button({ color, margin, layer }: IconButtonOptions) {
const theme = useTheme()
if (!color) color = "base"
const m = {
@@ -68,15 +67,15 @@ export function icon_button(
}
export function toggleable_icon_button(
theme: ColorScheme,
theme: Theme,
{ color, active_color, margin }: ToggleableIconButtonOptions
) {
if (!color) color = "base"
return toggleable({
state: {
inactive: icon_button(theme, { color, margin }),
active: icon_button(theme, {
inactive: icon_button({ color, margin }),
active: icon_button({
color: active_color ? active_color : color,
margin,
layer: theme.middle,
+16 -13
View File
@@ -5,27 +5,30 @@ import {
foreground,
text,
} from "../style_tree/components"
import { ColorScheme } from "../theme/color_scheme"
import { useTheme, Theme } from "../theme"
import { Margin } from "./icon_button"
interface TextButtonOptions {
layer?:
| ColorScheme["lowest"]
| ColorScheme["middle"]
| ColorScheme["highest"]
color?: keyof ColorScheme["lowest"]
| Theme["lowest"]
| Theme["middle"]
| Theme["highest"]
color?: keyof Theme["lowest"]
margin?: Partial<Margin>
text_properties?: TextProperties
}
type ToggleableTextButtonOptions = TextButtonOptions & {
active_color?: keyof ColorScheme["lowest"]
active_color?: keyof Theme["lowest"]
}
export function text_button(
theme: ColorScheme,
{ color, layer, margin, text_properties }: TextButtonOptions
) {
export function text_button({
color,
layer,
margin,
text_properties,
}: TextButtonOptions) {
const theme = useTheme()
if (!color) color = "base"
const text_options: TextProperties = {
@@ -72,15 +75,15 @@ export function text_button(
}
export function toggleable_text_button(
theme: ColorScheme,
theme: Theme,
{ color, active_color, margin }: ToggleableTextButtonOptions
) {
if (!color) color = "base"
return toggleable({
state: {
inactive: text_button(theme, { color, margin }),
active: text_button(theme, {
inactive: text_button({ color, margin }),
active: text_button({
color: active_color ? active_color : color,
margin,
layer: theme.middle,