Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(desktop-gpui): restyle settings and the recording quality page in a native grouped layout

Richie McIlroyb013e563bc63
diff --git a/apps/desktop-gpui/assets/icons/lock.svg b/apps/desktop-gpui/assets/icons/lock.svg
new file mode 100644
index 000000000..0be852f44
--- /dev/null
+++ b/apps/desktop-gpui/assets/icons/lock.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-lock-icon lucide-lock"><rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
diff --git a/apps/desktop-gpui/src/assets.rs b/apps/desktop-gpui/src/assets.rs
index 9c814a2e8..73e899420 100644
--- a/apps/desktop-gpui/src/assets.rs
+++ b/apps/desktop-gpui/src/assets.rs
@@ -194,6 +194,7 @@ const ICONS: &[(&str, &[u8])] = assets!("icons":
// integrations/index.tsx's inline multi-colour logo flattened to one fill
// (gpui's `svg()` keeps only the alpha).
"circle-check.svg",
+ "lock.svg",
// The screenshot editor's annotation toolbar, layers panel and header
// (`AnnotationTools.tsx`, `LayersPanel.tsx`, `Header.tsx`). Lucide 24x24
// originals, matching the `~icons/lucide/*` imports over there.
diff --git a/apps/desktop-gpui/src/settings_window.rs b/apps/desktop-gpui/src/settings_window.rs
index a1a7fb1fe..a2076a6fa 100644
--- a/apps/desktop-gpui/src/settings_window.rs
+++ b/apps/desktop-gpui/src/settings_window.rs
@@ -155,10 +155,12 @@ impl Page {
/// for the main window's screenshots button.
fn icon(self) -> &'static str {
match self {
- Self::General | Self::Experimental => "icons/settings.svg",
+ Self::General => "icons/settings.svg",
+ Self::Experimental => "icons/settings-2.svg",
Self::Shortcuts => "icons/hotkeys.svg",
Self::Cli => "icons/terminal.svg",
- Self::Recordings | Self::Quality => "icons/square-play.svg",
+ Self::Quality => "icons/gauge.svg",
+ Self::Recordings => "icons/square-play.svg",
Self::Screenshots => "icons/image.svg",
Self::Automations => "icons/zap.svg",
Self::Transcription => "icons/captions.svg",
@@ -235,37 +237,33 @@ const STUDIO_QUALITY_TIERS: &[(StudioQuality, &str, &str)] = &[
(
StudioQuality::Balanced,
"Balanced",
- "Clear, detailed recordings with a practical file size. Best for everyday use.",
+ "Sharp detail at a sensible file size. Right for most recordings.",
),
(
StudioQuality::Compatibility,
"Smaller files",
- "Uses less disk space. Can reduce detail, especially when recording with a camera.",
+ "Saves disk space. Fine detail can soften, most of all on camera.",
),
(
StudioQuality::Ultra,
"Maximum detail",
- "Preserves more detail for demanding edits. Creates larger files and needs more disk space.",
+ "Keeps the most detail for heavy editing. Uses the most disk space.",
),
];
const INSTANT_RESOLUTION_TIERS: &[(u32, &str, &str)] = &[
- (1280, "720p", "Smaller uploads. Good for quick updates."),
(
- 1920,
- "1080p",
- "Clear text and a practical upload size. Recommended with Cap Pro.",
+ 1280,
+ "720p",
+ "Smallest uploads, so links are ready fastest.",
),
+ (1920, "1080p", "Sharp text at a practical upload size."),
(
2560,
"1440p",
- "More detail for larger screens. Takes longer to upload.",
- ),
- (
- 3840,
- "4K",
- "The most detail and largest uploads. Best with a fast connection.",
+ "Extra detail for large, high-resolution screens.",
),
+ (3840, "4K", "The most detail. Best on a fast connection."),
];
/// `FREE_INSTANT_MODE_MAX_RESOLUTION`.
@@ -1753,7 +1751,7 @@ impl SettingsWindow {
// var(--sidebar-padding-x); overflow-y: auto }`, `space-y-1`.
.px(px(SIDEBAR_PADDING_X))
.pb(px(SIDEBAR_PADDING_X))
- .gap(px(4.))
+ .gap(px(2.))
.flex_1()
.min_h_0()
.overflow_y_scroll()
@@ -1766,16 +1764,17 @@ impl SettingsWindow {
.items_center()
// `.cap-settings-nav-item { height: 32px; padding: 6px;
// border-radius: 8px }`, `gap-1.5 text-[13px]`.
- .h(px(32.))
+ .h(px(30.))
.px(px(6.))
- .gap(px(6.))
+ .gap(px(8.))
.rounded(px(8.))
.text_size(px(13.))
.when(selected, |this| {
- // `.cap-settings-nav-item.bg-gray-5 { background:
- // var(--macos-settings-selection) }`, and the
- // `activeClass` also carries `pointer-events-none`.
- this.bg(theme.settings_selection())
+ this.bg(Theme::with_alpha(
+ rgb(Theme::SETTINGS_ACCENT),
+ if theme.is_dark() { 0.22 } else { 0.12 },
+ ))
+ .font_weight(FontWeight::MEDIUM)
})
.when(!selected, |this| {
this.hover(|style| style.bg(theme.settings_hover()))
@@ -1786,8 +1785,6 @@ impl SettingsWindow {
.size(px(16.))
.flex_shrink_0()
.text_color(if selected {
- // `.cap-settings-nav-item.bg-gray-5 svg
- // { color: var(--macos-settings-accent) }`
rgb(Theme::SETTINGS_ACCENT).into()
} else {
theme.settings_muted()
@@ -3111,7 +3108,8 @@ impl SettingsWindow {
return;
};
self.has_cap_pro = store::auth_snapshot().is_upgraded();
- if !self.has_cap_pro && resolution != FREE_INSTANT_MODE_MAX_RESOLUTION {
+ if self.instant_resolution_locked(resolution) {
+ cx.open_url(crate::auth::PRICING_URL);
cx.notify();
return;
}
@@ -3130,13 +3128,6 @@ impl SettingsWindow {
fn render_recording_quality(&self, cx: &mut Context<Self>) -> Vec<gpui::AnyElement> {
vec![
- self.section(
- "Recording quality",
- Some("Choose how new recordings look and how much space they use."),
- None,
- vec![],
- )
- .into_any_element(),
self.render_studio_quality(cx).into_any_element(),
self.render_instant_quality(cx).into_any_element(),
self.section(
@@ -3172,40 +3163,76 @@ impl SettingsWindow {
]
}
- fn render_instant_quality(&self, cx: &mut Context<Self>) -> impl IntoElement {
- let theme = self.theme;
- let effective = if self.has_cap_pro {
+ fn effective_instant_resolution(&self) -> u32 {
+ if self.has_cap_pro {
self.settings.instant_mode_max_resolution
} else {
FREE_INSTANT_MODE_MAX_RESOLUTION
- };
+ }
+ }
+
+ fn instant_resolution_locked(&self, resolution: u32) -> bool {
+ !self.has_cap_pro && resolution > FREE_INSTANT_MODE_MAX_RESOLUTION
+ }
+
+ fn render_instant_quality(&self, cx: &mut Context<Self>) -> impl IntoElement {
+ let theme = self.theme;
+ let effective = self.effective_instant_resolution();
let summary = INSTANT_RESOLUTION_TIERS
.iter()
.find(|(value, _, _)| *value == effective)
.map(|(_, _, summary)| *summary)
.unwrap_or_default();
- let body = self.card(true).child(
- div().id("settings-instant-quality").anchor_scroll(Some(self.instant_quality_anchor.clone()))
- .flex().flex_col().gap(px(12.))
- .child(div().text_size(px(13.)).font_weight(FontWeight::MEDIUM).child("Maximum resolution"))
- .child(self.segmented_raw("instant-resolution", INSTANT_RESOLUTION_TIERS.iter().map(|(value, label, _)| {
- let locked = !self.has_cap_pro && *value > FREE_INSTANT_MODE_MAX_RESOLUTION;
- ui::SegmentOption::new(if locked { format!("{label} · Pro") } else { (*label).to_string() }, *value == effective).disabled(locked)
- }).collect(), cx, |this, index, cx| this.select_instant_resolution(index, cx)))
- .child(div().text_size(px(12.)).line_height(px(18.)).text_color(theme.settings_muted()).child(format!("{summary} Resolution is limited by the screen or area you record.")))
- .when(!self.has_cap_pro, |this| this.child(
- div().flex().flex_col().items_start().gap(px(12.)).pt(px(12.)).border_t_1().border_color(theme.settings_border())
- .child(div().text_size(px(12.)).line_height(px(18.)).child("720p is included. Cap Pro unlocks 1080p, 1440p and 4K for Instant recordings."))
- .child(ui::Button::settings(&theme, "instant-quality-pricing", ui::ButtonVariant::Gray, ui::ButtonSize::Sm)
- .label("View plans ↗").on_click(|_, _, cx| cx.open_url(crate::auth::PRICING_URL)))
- ))
- .when_some(self.instant_quality_notice, |this, _| this.child(div().text_size(px(12.)).text_color(Hsla::from(theme.amber_11)).child("Couldn't save your recording settings. Please try again."))),
- );
+ let description = if self.has_cap_pro {
+ summary.to_string()
+ } else {
+ "720p on the free plan. Cap Pro records up to 4K.".to_string()
+ };
+
+ let options = INSTANT_RESOLUTION_TIERS
+ .iter()
+ .map(|(value, label, _)| {
+ let mut option = ui::SegmentOption::new(*label, *value == effective);
+ if self.instant_resolution_locked(*value) {
+ option.icon = Some("icons/lock.svg".into());
+ }
+ option
+ })
+ .collect();
+
+ let resolution = div()
+ .id("settings-instant-quality")
+ .anchor_scroll(Some(self.instant_quality_anchor.clone()))
+ .child(
+ ui::SettingRow::settings(
+ &theme,
+ "Maximum resolution",
+ None,
+ self.segmented_raw("instant-resolution", options, cx, |this, index, cx| {
+ this.select_instant_resolution(index, cx)
+ })
+ .into_any_element(),
+ )
+ .description(description),
+ );
+
+ let mut rows = vec![resolution.into_any_element()];
+ if let Some(InstantQualityNotice::SaveFailed) = self.instant_quality_notice {
+ rows.push(
+ div()
+ .p(px(12.))
+ .text_size(px(12.))
+ .text_color(Hsla::from(theme.amber_11))
+ .child("Couldn't save your recording settings. Please try again.")
+ .into_any_element(),
+ );
+ }
+
self.section(
- "Instant",
- Some("Uploads while you record, so your share link is ready when you stop."),
+ "Instant recordings",
+ Some("Uploaded while you record, so the link is ready the moment you stop."),
None,
- vec![body.into_any_element()],
+ vec![self.rows(rows).into_any_element()],
)
}
@@ -3221,41 +3248,140 @@ impl SettingsWindow {
cx.notify();
}
+ /// A macOS-style radio button: a hairline ring at rest, an accent disc
+ /// with a white centre when chosen.
+ fn radio_dot(&self, checked: bool) -> gpui::Div {
+ let theme = self.theme;
+ let accent: Hsla = rgb(Theme::SETTINGS_ACCENT).into();
+ div()
+ .size(px(16.))
+ .flex_none()
+ .flex()
+ .items_center()
+ .justify_center()
+ .rounded_full()
+ .when(checked, |this| {
+ this.bg(accent)
+ .child(div().size(px(6.)).rounded_full().bg(gpui::white()))
+ })
+ .when(!checked, |this| {
+ this.border_1()
+ .border_color(theme.settings_border())
+ .group_hover("studio-quality-option", |style| {
+ style.border_color(theme.settings_muted())
+ })
+ .bg(if theme.is_dark() {
+ gpui::hsla(0., 0., 1., 0.1)
+ } else {
+ gpui::white()
+ })
+ .shadow(vec![gpui::BoxShadow {
+ color: gpui::hsla(0., 0., 0., 0.12),
+ offset: gpui::point(px(0.), px(0.5)),
+ blur_radius: px(1.),
+ spread_radius: px(0.),
+ inset: false,
+ }])
+ })
+ }
+
fn render_studio_quality(&self, cx: &mut Context<Self>) -> impl IntoElement {
let theme = self.theme;
let current = self.settings.studio_recording_quality;
- let body = self.card(true).child(
- div().id("settings-studio-quality").anchor_scroll(Some(self.studio_quality_anchor.clone()))
- .flex().flex_col().gap(px(8.))
- .children(STUDIO_QUALITY_TIERS.iter().copied().map(|(quality, label, description)| {
- let selected = current == quality;
- div().id(SharedString::from(format!("studio-quality-{}", quality.as_json())))
- .tab_index(0).aria_label(label).aria_description(description).aria_selected(selected)
- .cursor_pointer().flex().flex_col().gap(px(4.)).p(px(12.)).rounded(px(8.))
- .border_1().border_color(if selected { Hsla::from(theme.blue_9) } else { theme.settings_border() })
- .bg(if selected { theme.settings_selection() } else { theme.settings_card_bg() })
- .hover(|style| style.bg(theme.settings_fill()))
- .child(div().flex().items_center().gap(px(8.))
- .child(div().text_size(px(13.)).font_weight(FontWeight::MEDIUM).child(label))
- .when(quality == StudioQuality::Balanced, |this| this.child(div().text_size(px(10.)).text_color(Hsla::from(theme.blue_11)).child("Recommended")))
- .when(selected, |this| this.child(div().text_size(px(12.)).text_color(Hsla::from(theme.blue_11)).child("✓"))))
- .child(div().text_size(px(12.)).line_height(px(18.)).text_color(theme.settings_muted()).child(description))
- .on_click(cx.listener(move |this, _, _, cx| {
+
+ let mut rows: Vec<gpui::AnyElement> = STUDIO_QUALITY_TIERS
+ .iter()
+ .copied()
+ .map(|(quality, label, description)| {
+ let selected = current == quality;
+ div()
+ .id(SharedString::from(format!(
+ "studio-quality-{}",
+ quality.as_json()
+ )))
+ .tab_index(0)
+ .aria_label(label)
+ .aria_description(description)
+ .aria_selected(selected)
+ .cursor_pointer()
+ .flex()
+ .items_start()
+ .gap(px(10.))
+ .p(px(12.))
+ .group("studio-quality-option")
+ .child(div().mt(px(1.)).child(self.radio_dot(selected)))
+ .child(
+ div()
+ .flex()
+ .flex_col()
+ .flex_1()
+ .min_w_0()
+ .gap(px(2.))
+ .child(
+ div()
+ .flex()
+ .items_center()
+ .gap(px(6.))
+ .child(div().text_size(px(13.)).child(label))
+ .when(quality == StudioQuality::Balanced, |this| {
+ this.child(
+ div()
+ .px(px(6.))
+ .py(px(1.))
+ .rounded(px(4.))
+ .bg(theme.settings_fill())
+ .text_size(px(11.))
+ .text_color(theme.settings_muted())
+ .child("Recommended"),
+ )
+ }),
+ )
+ .child(
+ div()
+ .text_size(px(12.))
+ .line_height(px(16.))
+ .text_color(theme.settings_muted())
+ .child(description),
+ ),
+ )
+ .on_click(cx.listener(move |this, _, _, cx| {
+ this.select_studio_quality(quality, cx);
+ }))
+ .on_key_down(cx.listener(move |this, event: &gpui::KeyDownEvent, _, cx| {
+ if event.keystroke.modifiers == Default::default()
+ && matches!(event.keystroke.key.as_str(), "enter" | "space")
+ {
this.select_studio_quality(quality, cx);
- }))
- .on_key_down(cx.listener(move |this, event: &gpui::KeyDownEvent, _, cx| {
- if event.keystroke.modifiers == Default::default()
- && matches!(event.keystroke.key.as_str(), "enter" | "space")
- {
- this.select_studio_quality(quality, cx);
- cx.stop_propagation();
- }
- }))
- }))
- .when(self.studio_quality_save_failed, |this| this.child(div().text_size(px(12.)).line_height(px(18.)).text_color(Hsla::from(theme.amber_11)).child("Couldn't save your recording settings. Please try again.")))
- .child(div().mt(px(4.)).text_size(px(12.)).line_height(px(18.)).text_color(theme.settings_muted()).child("These options affect the original recording. Choose your final export resolution and file size in the editor.")),
- );
- self.section("Studio", Some("Saved to your computer, ready to edit. All three quality options are available on every plan."), None, vec![body.into_any_element()])
+ cx.stop_propagation();
+ }
+ }))
+ .into_any_element()
+ })
+ .collect();
+
+ if self.studio_quality_save_failed {
+ rows.push(
+ div()
+ .p(px(12.))
+ .text_size(px(12.))
+ .text_color(Hsla::from(theme.amber_11))
+ .child("Couldn't save your recording settings. Please try again.")
+ .into_any_element(),
+ );
+ }
+
+ self.section(
+ "Studio recordings",
+ Some("Saved to your computer for editing. You choose the export size later, in the editor."),
+ None,
+ vec![
+ div()
+ .id("settings-studio-quality")
+ .anchor_scroll(Some(self.studio_quality_anchor.clone()))
+ .child(self.rows(rows))
+ .into_any_element(),
+ ],
+ )
}
/// The Recording card: thirteen rows, in TSX order.
diff --git a/apps/desktop-gpui/src/theme.rs b/apps/desktop-gpui/src/theme.rs
index 371080b33..35030ff74 100644
--- a/apps/desktop-gpui/src/theme.rs
+++ b/apps/desktop-gpui/src/theme.rs
@@ -209,14 +209,11 @@ impl MaterialTokens {
fill: rgba(0x0000000b),
// `--macos-settings-hover: rgba(0, 0, 0, 0.065)`
hover: rgba(0x00000011),
- // `--macos-settings-sidebar: rgba(255, 255, 255, 0.58)`
- sidebar: rgba(0xffffff94),
- // `--macos-settings-content: #f6f6f5` -- opaque, unlike every
- // other surface here: under Liquid Glass only the sidebar
- // shows the backdrop.
- content: rgba(0xf6f6f5ff),
- // `--macos-settings-card: rgba(255, 255, 255, 0.92)`
- card: rgba(0xffffffeb),
+ sidebar: rgba(0xffffffc7),
+ // System Settings' grouped style: a white pane with faintly
+ // grey inset groups, rather than white cards on grey.
+ content: rgba(0xffffffff),
+ card: rgba(0x0000000a),
// `--macos-settings-window-radius: 26px`
window_radius: 26.,
// `--macos-settings-sidebar-radius: 18px`
@@ -249,10 +246,8 @@ impl MaterialTokens {
hover: rgba(0xffffff0d),
// `--macos-settings-sidebar: rgba(28, 28, 28, 0.88)`
sidebar: rgba(0x1c1c1ce0),
- // `--macos-settings-content: rgba(17, 17, 17, 0.92)`
- content: rgba(0x111111eb),
- // `--macos-settings-card: rgba(28, 28, 28, 0.94)`
- card: rgba(0x1c1c1cf0),
+ content: rgba(0x1e1e1eff),
+ card: rgba(0xffffff0d),
// The radii are set once, outside the `.dark` block.
window_radius: 26.,
sidebar_radius: 18.,
@@ -292,10 +287,8 @@ impl MaterialTokens {
hover: rgba(0x0000000e),
// `--macos-settings-sidebar: rgba(250, 250, 249, 0.74)`
sidebar: rgba(0xfafaf9bd),
- // `--macos-settings-content: rgba(244, 244, 243, 0.84)`
- content: rgba(0xf4f4f3d6),
- // `--macos-settings-card: rgba(249, 249, 248, 0.94)`
- card: rgba(0xf9f9f8f0),
+ content: rgba(0xfbfbfbff),
+ card: rgba(0x0000000a),
// `--macos-settings-window-radius: 16px`
window_radius: 16.,
// `--macos-settings-sidebar-radius: 0px`
@@ -324,10 +317,8 @@ impl MaterialTokens {
// `--macos-settings-sidebar: rgba(22, 22, 22, 0.9)` -- the one
// settings surface the glass block does *not* just re-tint.
sidebar: rgba(0x161616e6),
- // `--macos-settings-content: rgba(17, 17, 17, 0.94)`
- content: rgba(0x111111f0),
- // `--macos-settings-card: rgba(28, 28, 28, 0.96)`
- card: rgba(0x1c1c1cf5),
+ content: rgba(0x1e1e1eff),
+ card: rgba(0xffffff0d),
window_radius: 16.,
sidebar_radius: 0.,
},
@@ -1302,13 +1293,13 @@ mod tests {
}
// The sidebar is a wash over the live backdrop; the content pane is
- // `#f6f6f5`, fully opaque, in light mode only.
+ // opaque in both appearances.
let light = Theme::light().with_material(Some(MaterialKind::LiquidGlass));
- assert!((light.settings_sidebar_bg().a - 0.58).abs() < 0.01);
+ assert!((light.settings_sidebar_bg().a - 0.78).abs() < 0.01);
assert_eq!(light.settings_content_bg().a, 1.);
let dark = Theme::dark().with_material(Some(MaterialKind::LiquidGlass));
assert!((dark.settings_sidebar_bg().a - 0.88).abs() < 0.01);
- assert!((dark.settings_content_bg().a - 0.92).abs() < 0.01);
+ assert_eq!(dark.settings_content_bg().a, 1.);
}
/// Vibrancy keeps the `:root` radius and the pre-Tahoe surface set, and
diff --git a/apps/desktop-gpui/src/ui/menu.rs b/apps/desktop-gpui/src/ui/menu.rs
index eefeebe02..01bbd8af4 100644
--- a/apps/desktop-gpui/src/ui/menu.rs
+++ b/apps/desktop-gpui/src/ui/menu.rs
@@ -176,8 +176,11 @@ impl Menu {
items: Vec<MenuItem>,
state: &MenuState,
) -> Self {
- let mut bg = theme.settings_card_bg();
- bg.a = 1.;
+ let bg = if theme.is_dark() {
+ Hsla::from(gpui::rgb(0x2a2a2c))
+ } else {
+ gpui::white()
+ };
Self {
id: id.into(),
items,
@@ -186,8 +189,14 @@ impl Menu {
highlighted: state.visible_highlight(),
min_width: px(180.),
max_height: px(320.),
- radius: px(8.),
- shadow: Vec::new(),
+ radius: px(10.),
+ shadow: vec![gpui::BoxShadow {
+ color: gpui::hsla(0., 0., 0., 0.18),
+ offset: gpui::point(px(0.), px(6.)),
+ blur_radius: px(18.),
+ spread_radius: px(0.),
+ inset: false,
+ }],
bg,
border: theme.settings_border(),
hover: theme.settings_hover(),
diff --git a/apps/desktop-gpui/src/ui/segmented.rs b/apps/desktop-gpui/src/ui/segmented.rs
index 21f7f4093..42c5d663a 100644
--- a/apps/desktop-gpui/src/ui/segmented.rs
+++ b/apps/desktop-gpui/src/ui/segmented.rs
@@ -130,17 +130,31 @@ impl SegmentedControl {
}
}
- /// The settings window: `inline-flex p-0.5 rounded-lg border border-gray-3
- /// bg-gray-3` with `px-3 py-1 text-xs font-medium rounded-md` items. The
- /// selected item is `bg-gray-1 text-gray-12 shadow-sm` -- `bg-gray-1` is
- /// not in the settings material's remap list, so it stays literal.
+ /// The settings window: a borderless trough with the chosen segment raised
+ /// on a white pill, the way AppKit draws a segmented control.
pub fn settings(theme: &Theme, id: impl Into<ElementId>, options: Vec<SegmentOption>) -> Self {
Self {
container_bg: Some(theme.settings_fill()),
- container_border: Some(theme.settings_border()),
- selected_bg: Some(Hsla::from(theme.gray_1)),
+ container_border: None,
+ container_radius: px(8.),
+ item_padding_x: px(10.),
+ item_padding_y: px(0.),
+ item_height: Some(px(24.)),
+ item_gap: px(4.),
+ icon_size: px(11.),
+ selected_bg: Some(if theme.is_dark() {
+ gpui::hsla(0., 0., 1., 0.16)
+ } else {
+ gpui::white()
+ }),
selected_text: theme.settings_text(),
idle_text: theme.settings_muted(),
+ hover_bg: Some(theme.settings_hover()),
+ selected_shadow: if theme.is_dark() {
+ Vec::new()
+ } else {
+ crate::theme::raised_pill_shadow()
+ },
..Self::base(theme, id, options)
}
}
diff --git a/apps/desktop-gpui/src/ui/surface.rs b/apps/desktop-gpui/src/ui/surface.rs
index 885ace399..21fd5b779 100644
--- a/apps/desktop-gpui/src/ui/surface.rs
+++ b/apps/desktop-gpui/src/ui/surface.rs
@@ -14,25 +14,25 @@ use crate::theme::Theme;
pub struct Card;
impl Card {
- /// The settings card: radius 10 and no border under the settings material,
- /// filled with `--macos-settings-card`.
+ /// The settings card: a System Settings group, radius 12 and no border.
pub fn settings(theme: &Theme, padded: bool) -> Div {
div()
- .rounded(px(10.))
+ .rounded(px(12.))
.overflow_hidden()
.bg(theme.settings_card_bg())
.when(padded, |this| this.px(px(16.)).py(px(16.)))
}
- /// The same card with `divide-y divide-gray-3` between its rows.
+ /// The same card with hairlines between its rows, inset from both edges
+ /// the way AppKit's grouped forms draw them.
pub fn settings_rows(theme: &Theme, children: Vec<AnyElement>) -> Div {
let border = theme.settings_border();
let last = children.len().saturating_sub(1);
Card::settings(theme, false).flex().flex_col().children(
children.into_iter().enumerate().map(|(index, child)| {
- div()
- .when(index != last, |this| this.border_b_1().border_color(border))
- .child(child)
+ div().child(child).when(index != last, |this| {
+ this.child(div().mx(px(12.)).h(px(1.)).bg(border))
+ })
}),
)
}
@@ -143,6 +143,11 @@ impl SettingRow {
muted: theme.settings_muted(),
}
}
+
+ pub fn description(mut self, description: impl Into<SharedString>) -> Self {
+ self.description = Some(description.into());
+ self
+ }
}
impl RenderOnce for SettingRow {
@@ -260,14 +265,8 @@ impl RenderOnce for Section {
.gap(px(8.))
.child(
div()
- .text_size(px(14.))
- // `text-sm font-semibold
- // tracking-tight`
- // (`settings/Setting.tsx:27`).
- // `font-semibold` renders 700: no
- // 600 face is loaded over there
- // (`ui-solid/vite.js:31-33`).
- .font_weight(FontWeight::BOLD)
+ .text_size(px(13.))
+ .font_weight(FontWeight::SEMIBOLD)
.child(title),
)
.when(pro, |this| {