refactor: fix hardcoded values, remove println, remove doubles
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import { Theme } from "./theme.slint";
|
||||
|
||||
export component BrowserItem inherits Rectangle {
|
||||
in property <int> index;
|
||||
in property <image> browser-icon;
|
||||
in property <string> emoji;
|
||||
in property <bool> icon-mask;
|
||||
in property <string> browser-name;
|
||||
in property <bool> is-default;
|
||||
in property <bool> selected;
|
||||
callback clicked;
|
||||
callback clicked(int);
|
||||
|
||||
height: 84px;
|
||||
background: transparent;
|
||||
@@ -20,12 +21,12 @@ export component BrowserItem inherits Rectangle {
|
||||
: root.selected ? Theme.surface-elevated
|
||||
: Theme.surface-item;
|
||||
border-width: root.selected ? 2px : 1px;
|
||||
border-color: root.selected ? #3b82f680 : transparent;
|
||||
border-color: root.selected ? Theme.accent-ring : transparent;
|
||||
|
||||
touch := TouchArea {
|
||||
mouse-cursor: pointer;
|
||||
clicked => {
|
||||
root.clicked();
|
||||
root.clicked(root.index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +85,7 @@ export component BrowserItem inherits Rectangle {
|
||||
if root.is-default: Rectangle {
|
||||
height: 22px;
|
||||
border-radius: 11px;
|
||||
background: #3b82f620;
|
||||
background: Theme.accent-soft;
|
||||
|
||||
HorizontalLayout {
|
||||
padding-left: 10px;
|
||||
@@ -109,7 +110,7 @@ export component BrowserItem inherits Rectangle {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
source: @image-url("../icons/check.svg");
|
||||
colorize: #3b82f6;
|
||||
colorize: Theme.accent;
|
||||
visible: root.selected;
|
||||
}
|
||||
|
||||
|
||||
+7
-6
@@ -1,4 +1,4 @@
|
||||
import { Button, CheckBox, ListView } from "std-widgets.slint";
|
||||
import { ListView } from "std-widgets.slint";
|
||||
import { BrowserItem } from "./browser_item.slint";
|
||||
import { Header } from "./header.slint";
|
||||
import { Footer } from "./footer.slint";
|
||||
@@ -32,9 +32,9 @@ component CheckRow inherits Rectangle {
|
||||
Rectangle {
|
||||
width: 20px;
|
||||
border-radius: 6px;
|
||||
background: root.checked ? #3b82f6 : transparent;
|
||||
background: root.checked ? Theme.accent : transparent;
|
||||
border-width: 2px;
|
||||
border-color: root.checked ? #3b82f6 : Theme.border-main;
|
||||
border-color: root.checked ? Theme.accent : Theme.border-main;
|
||||
|
||||
Image {
|
||||
x: (parent.width - self.width) / 2;
|
||||
@@ -65,7 +65,7 @@ export component MainWindow inherits Window {
|
||||
in-out property <bool> always-ask: true;
|
||||
in property <int> selected-index: 0;
|
||||
|
||||
callback launch-browser(BrowserConfig);
|
||||
callback launch-browser(int);
|
||||
callback toggle-remember(bool);
|
||||
callback toggle-always-ask(bool);
|
||||
callback settings-clicked();
|
||||
@@ -128,14 +128,15 @@ export component MainWindow inherits Window {
|
||||
vertical-stretch: 1;
|
||||
|
||||
for browser[i] in root.browser-model: BrowserItem {
|
||||
index: i;
|
||||
browser-icon: browser.icon;
|
||||
emoji: browser.emoji;
|
||||
icon-mask: browser.icon-mask;
|
||||
browser-name: browser.name;
|
||||
is-default: browser.is-default;
|
||||
selected: i == root.selected-index;
|
||||
clicked => {
|
||||
root.launch-browser(browser);
|
||||
clicked(idx) => {
|
||||
root.launch-browser(idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -137,7 +137,7 @@ export component SettingsWindow inherits Window {
|
||||
Rectangle {
|
||||
width: 30px;
|
||||
border-radius: 6px;
|
||||
background: del-touch.has-hover ? #ef444420 : transparent;
|
||||
background: del-touch.has-hover ? Theme.danger-soft : transparent;
|
||||
|
||||
del-touch := TouchArea {
|
||||
mouse-cursor: pointer;
|
||||
@@ -152,7 +152,7 @@ export component SettingsWindow inherits Window {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
source: @image-url("../icons/trash.svg");
|
||||
colorize: del-touch.has-hover ? #ef4444 : Theme.text-muted;
|
||||
colorize: del-touch.has-hover ? Theme.danger : Theme.text-muted;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -209,7 +209,7 @@ export component SettingsWindow inherits Window {
|
||||
Rectangle {
|
||||
width: 30px;
|
||||
border-radius: 6px;
|
||||
background: del2-touch.has-hover ? #ef444420 : transparent;
|
||||
background: del2-touch.has-hover ? Theme.danger-soft : transparent;
|
||||
|
||||
del2-touch := TouchArea {
|
||||
mouse-cursor: pointer;
|
||||
@@ -224,7 +224,7 @@ export component SettingsWindow inherits Window {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
source: @image-url("../icons/trash.svg");
|
||||
colorize: del2-touch.has-hover ? #ef4444 : Theme.text-muted;
|
||||
colorize: del2-touch.has-hover ? Theme.danger : Theme.text-muted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,12 @@ export global Theme {
|
||||
|
||||
out property <brush> text-hint: is-dark ? #475569 : #475569;
|
||||
|
||||
out property <color> accent: #3b82f6;
|
||||
out property <color> accent-ring: #3b82f680;
|
||||
out property <color> accent-soft: #3b82f620;
|
||||
out property <color> danger: #ef4444;
|
||||
out property <color> danger-soft: #ef444420;
|
||||
|
||||
out property <brush> shadow-color: is-dark ? #3b82f640 : #3b82f640;
|
||||
|
||||
out property <length> shadow-primary-x: 0px;
|
||||
|
||||
Reference in New Issue
Block a user