summaryrefslogtreecommitdiff
path: root/src/widgets/popdownwindow.tsx
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-01-17 00:16:40 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-01-17 00:16:40 +1100
commit0518ec4214583bcc26f5b052f02fd93b12a00a77 (patch)
tree0cfac1c39d54a504215a4b98c8be271e66759295 /src/widgets/popdownwindow.tsx
parentrefactor: move popdowns to own folder (diff)
downloadcaelestia-shell-0518ec4214583bcc26f5b052f02fd93b12a00a77.tar.gz
caelestia-shell-0518ec4214583bcc26f5b052f02fd93b12a00a77.tar.bz2
caelestia-shell-0518ec4214583bcc26f5b052f02fd93b12a00a77.zip
bluetoothdevices: make popup window
Diffstat (limited to 'src/widgets/popdownwindow.tsx')
-rw-r--r--src/widgets/popdownwindow.tsx15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/widgets/popdownwindow.tsx b/src/widgets/popdownwindow.tsx
index 8710a59..18e9ae9 100644
--- a/src/widgets/popdownwindow.tsx
+++ b/src/widgets/popdownwindow.tsx
@@ -5,6 +5,7 @@ import PopupWindow from "./popupwindow";
export default ({
name,
count,
+ countLabel = count.as(c => `${c} ${name.slice(0, -1)}${c === 1 ? "" : "s"}`),
headerButtons,
emptyIcon,
emptyLabel,
@@ -12,7 +13,8 @@ export default ({
}: {
name: string;
count: Binding<number>;
- headerButtons: { label: string; onClicked: () => void; className?: Binding<string> }[];
+ countLabel?: Binding<string>;
+ headerButtons: { label: string | Binding<string>; onClicked: () => void; enabled?: Binding<boolean> }[];
emptyIcon: string;
emptyLabel: string;
list: JSX.Element;
@@ -20,10 +22,15 @@ export default ({
<PopupWindow name={name}>
<box vertical className={name}>
<box className="header">
- <label label={count.as(c => `${c} ${name.slice(0, -1)}${c === 1 ? "" : "s"}`)} />
+ <label label={countLabel} />
<box hexpand />
- {headerButtons.map(({ label, onClicked, className }) => (
- <button cursor="pointer" onClicked={onClicked} label={label} className={className} />
+ {headerButtons.map(({ label, onClicked, enabled }) => (
+ <button
+ cursor="pointer"
+ onClicked={onClicked}
+ label={label}
+ className={enabled?.as(d => (d ? "enabled" : ""))}
+ />
))}
</box>
<stack