Updated the settings dialog button styling.

This commit is contained in:
Jas Singh
2024-07-26 23:58:16 -07:00
parent 932006f760
commit 77c79a2d99
5 changed files with 90 additions and 44 deletions

View File

@@ -1,25 +1,7 @@
import { Opt } from "lib/option"
import Gdk from "gi://Gdk"
import icons from "lib/icons"
export type RowProps<T> = {
opt: Opt<T>
title: string
note?: string
type?:
| "number"
| "color"
| "float"
| "object"
| "string"
| "enum"
| "boolean"
| "img"
| "font"
enums?: string[]
max?: number
min?: number
}
import { RowProps } from "lib/types/options"
const EnumSetter = (opt: Opt<string>, values: string[]) => {
const lbl = Widget.Label({ label: opt.bind().as(v => `${v}`) })

View File

@@ -1,20 +1,20 @@
export const Label = (name, sub = "") => {
return Widget.Box({
vertical: true,
hpack: "start",
children: [
Widget.Label({
export const Label = (name: string, sub = "") => {
return Widget.Box({
vertical: true,
hpack: "start",
vpack: "center",
class_name: "options-label",
label: name
}),
Widget.Label({
hpack: "start",
vpack: "center",
class_name: "options-sublabel",
label: sub
}),
]
})
children: [
Widget.Label({
hpack: "start",
vpack: "center",
class_name: "options-label",
label: name
}),
Widget.Label({
hpack: "start",
vpack: "center",
class_name: "options-sublabel",
label: sub
}),
]
})
}

View File

@@ -1,8 +1,14 @@
import { Label } from "./Label";
import { Inputter } from "./Inputter";
import icons from "lib/icons";
import { RowProps } from "lib/types/options";
export const Option = (props, className = '') => {
type Option = {
title: string,
subtitle: string,
}
export const Option = <T>(props: RowProps<T>, className: string = '') => {
return Widget.Box({
class_name: "option-item",
hexpand: true,
@@ -16,7 +22,7 @@ export const Option = (props, className = '') => {
Inputter(props, className),
Widget.Button({
vpack: "center",
class_name: "reset",
class_name: "reset-options",
child: Widget.Icon(icons.ui.refresh),
on_clicked: () => props.opt.reset(),
sensitive: props.opt.bind().as(v => v !== props.opt.initial),