Move breadcrumb style to toolbar
This commit is contained in:
parent
c9b1237079
commit
2af5fc5030
4 changed files with 25 additions and 24 deletions
|
@ -50,7 +50,7 @@ impl View for Breadcrumbs {
|
||||||
let not_editor = active_item.downcast::<editor::Editor>().is_none();
|
let not_editor = active_item.downcast::<editor::Editor>().is_none();
|
||||||
|
|
||||||
let theme = theme::current(cx).clone();
|
let theme = theme::current(cx).clone();
|
||||||
let style = &theme.workspace.breadcrumbs;
|
let style = &theme.workspace.toolbar.breadcrumbs;
|
||||||
|
|
||||||
let breadcrumbs = match active_item.breadcrumbs(&theme, cx) {
|
let breadcrumbs = match active_item.breadcrumbs(&theme, cx) {
|
||||||
Some(breadcrumbs) => breadcrumbs,
|
Some(breadcrumbs) => breadcrumbs,
|
||||||
|
@ -60,7 +60,7 @@ impl View for Breadcrumbs {
|
||||||
.map(|breadcrumb| {
|
.map(|breadcrumb| {
|
||||||
Text::new(
|
Text::new(
|
||||||
breadcrumb.text,
|
breadcrumb.text,
|
||||||
theme.workspace.breadcrumbs.default.text.clone(),
|
theme.workspace.toolbar.breadcrumbs.default.text.clone(),
|
||||||
)
|
)
|
||||||
.with_highlights(breadcrumb.highlights.unwrap_or_default())
|
.with_highlights(breadcrumb.highlights.unwrap_or_default())
|
||||||
.into_any()
|
.into_any()
|
||||||
|
@ -68,10 +68,10 @@ impl View for Breadcrumbs {
|
||||||
|
|
||||||
let crumbs = Flex::row()
|
let crumbs = Flex::row()
|
||||||
.with_children(Itertools::intersperse_with(breadcrumbs, || {
|
.with_children(Itertools::intersperse_with(breadcrumbs, || {
|
||||||
Label::new(" 〉 ", style.default.text.clone()).into_any()
|
Label::new(" › ", style.default.text.clone()).into_any()
|
||||||
}))
|
}))
|
||||||
.constrained()
|
.constrained()
|
||||||
.with_height(theme.workspace.breadcrumb_height)
|
.with_height(theme.workspace.toolbar.breadcrumb_height)
|
||||||
.contained();
|
.contained();
|
||||||
|
|
||||||
if not_editor || !self.pane_focused {
|
if not_editor || !self.pane_focused {
|
||||||
|
|
|
@ -88,8 +88,6 @@ pub struct Workspace {
|
||||||
pub dock: Dock,
|
pub dock: Dock,
|
||||||
pub status_bar: StatusBar,
|
pub status_bar: StatusBar,
|
||||||
pub toolbar: Toolbar,
|
pub toolbar: Toolbar,
|
||||||
pub breadcrumb_height: f32,
|
|
||||||
pub breadcrumbs: Interactive<ContainedText>,
|
|
||||||
pub disconnected_overlay: ContainedText,
|
pub disconnected_overlay: ContainedText,
|
||||||
pub modal: ContainerStyle,
|
pub modal: ContainerStyle,
|
||||||
pub zoomed_panel_foreground: ContainerStyle,
|
pub zoomed_panel_foreground: ContainerStyle,
|
||||||
|
@ -411,6 +409,8 @@ pub struct Toolbar {
|
||||||
pub height: f32,
|
pub height: f32,
|
||||||
pub item_spacing: f32,
|
pub item_spacing: f32,
|
||||||
pub toggleable_tool: Toggleable<Interactive<IconButton>>,
|
pub toggleable_tool: Toggleable<Interactive<IconButton>>,
|
||||||
|
pub breadcrumb_height: f32,
|
||||||
|
pub breadcrumbs: Interactive<ContainedText>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Default, JsonSchema)]
|
#[derive(Clone, Deserialize, Default, JsonSchema)]
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { useTheme } from "../common"
|
import { useTheme } from "../common"
|
||||||
import { toggleable_icon_button } from "../component/icon_button"
|
import { toggleable_icon_button } from "../component/icon_button"
|
||||||
import { background, border } from "./components"
|
import { interactive } from "../element"
|
||||||
|
import { background, border, foreground, text } from "./components"
|
||||||
|
|
||||||
export const toolbar = () => {
|
export const toolbar = () => {
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
|
@ -16,5 +17,22 @@ export const toolbar = () => {
|
||||||
variant: "ghost",
|
variant: "ghost",
|
||||||
active_color: "accent",
|
active_color: "accent",
|
||||||
}),
|
}),
|
||||||
|
breadcrumb_height: 24,
|
||||||
|
breadcrumbs: interactive({
|
||||||
|
base: {
|
||||||
|
...text(theme.highest, "sans", "variant"),
|
||||||
|
corner_radius: 6,
|
||||||
|
padding: {
|
||||||
|
left: 6,
|
||||||
|
right: 6,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
state: {
|
||||||
|
hovered: {
|
||||||
|
color: foreground(theme.highest, "on", "hovered"),
|
||||||
|
background: background(theme.highest, "on", "hovered"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,23 +129,6 @@ export default function workspace(): any {
|
||||||
status_bar: statusBar(),
|
status_bar: statusBar(),
|
||||||
titlebar: titlebar(),
|
titlebar: titlebar(),
|
||||||
toolbar: toolbar(),
|
toolbar: toolbar(),
|
||||||
breadcrumb_height: 24,
|
|
||||||
breadcrumbs: interactive({
|
|
||||||
base: {
|
|
||||||
...text(theme.highest, "sans", "variant"),
|
|
||||||
corner_radius: 6,
|
|
||||||
padding: {
|
|
||||||
left: 6,
|
|
||||||
right: 6,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
state: {
|
|
||||||
hovered: {
|
|
||||||
color: foreground(theme.highest, "on", "hovered"),
|
|
||||||
background: background(theme.highest, "on", "hovered"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
disconnected_overlay: {
|
disconnected_overlay: {
|
||||||
...text(theme.lowest, "sans"),
|
...text(theme.lowest, "sans"),
|
||||||
background: with_opacity(background(theme.lowest), 0.8),
|
background: with_opacity(background(theme.lowest), 0.8),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue