settings_ui: Add UI and buffer font weight controls (#15104)

This PR adds settings controls for the UI and buffer font weight
settings.

It also does some work around grouping the settings into related
sections.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-07-24 14:09:13 -04:00 committed by GitHub
parent 7fb906d774
commit 274e56b086
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 557 additions and 272 deletions

View file

@ -0,0 +1,36 @@
use gpui::AnyElement;
use smallvec::SmallVec;
use crate::{prelude::*, ListHeader};
/// A group of settings.
#[derive(IntoElement)]
pub struct SettingsGroup {
header: SharedString,
children: SmallVec<[AnyElement; 2]>,
}
impl SettingsGroup {
pub fn new(header: impl Into<SharedString>) -> Self {
Self {
header: header.into(),
children: SmallVec::new(),
}
}
}
impl ParentElement for SettingsGroup {
fn extend(&mut self, elements: impl IntoIterator<Item = AnyElement>) {
self.children.extend(elements)
}
}
impl RenderOnce for SettingsGroup {
fn render(self, _cx: &mut WindowContext) -> impl IntoElement {
v_flex()
.p_1()
.gap_2()
.child(ListHeader::new(self.header))
.children(self.children)
}
}