// SPDX-FileCopyrightText: 2024 vivi developers // SPDX-License-Identifier: MIT import { ButtonStyle } from "../foundation.slint"; import { ButtonAction } from "./magic_button_base.slint"; import { OutlineButton } from "./outline_button.slint"; import { MagicPalette, MagicFontSettings, MagicIconSettings, MagicSizeSettings, MagicLayoutSettings, MagicBorderSettings } from "./styling.slint"; export component TextButton inherits OutlineButton { in property action; property default_style: { border_style: { border_radius: MagicBorderSettings.control_border_radius, }, text_style: { font_size: MagicFontSettings.body.font_size, font_weight: MagicFontSettings.body.font_weight, foreground: MagicPalette.foreground, }, icon_style: { icon_size: MagicIconSettings.body.icon_size, foreground: MagicPalette.foreground, }, layout_style: { padding_left: MagicLayoutSettings.control_padding, padding_right: MagicLayoutSettings.control_padding, spacing: MagicLayoutSettings.control_spacing, alignment: LayoutAlignment.center, } }; property primary_style: { border_style: { border_radius: MagicBorderSettings.control_border_radius, }, text_style: { font_size: MagicFontSettings.body.font_size, font_weight: MagicFontSettings.body.font_weight, foreground: MagicPalette.accent_background, }, icon_style: { icon_size: MagicIconSettings.body.icon_size, foreground: MagicPalette.accent_background, }, layout_style: { padding_left: MagicLayoutSettings.control_padding, padding_right: MagicLayoutSettings.control_padding, spacing: MagicLayoutSettings.control_spacing, alignment: LayoutAlignment.center, } }; property destructive_style: { border_style: { border_radius: MagicBorderSettings.control_border_radius, }, text_style: { font_size: MagicFontSettings.body.font_size, font_weight: MagicFontSettings.body.font_weight, foreground: MagicPalette.destructive_background, }, icon_style: { icon_size: MagicIconSettings.body.icon_size, foreground: MagicPalette.destructive_background, }, layout_style: { padding_left: MagicLayoutSettings.control_padding, padding_right: MagicLayoutSettings.control_padding, spacing: MagicLayoutSettings.control_spacing, alignment: LayoutAlignment.center, } }; style: root.action == ButtonAction.default ? root.default_style : root.action == ButtonAction.primary ? root.primary_style : root.destructive_style; }