Tweak welcome design

Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
This commit is contained in:
Nate Butler 2023-03-08 17:14:15 -05:00
parent cc33f83e4e
commit 344f59adf7
3 changed files with 53 additions and 20 deletions

View file

@ -855,6 +855,7 @@ pub struct FeedbackStyle {
#[derive(Clone, Deserialize, Default)] #[derive(Clone, Deserialize, Default)]
pub struct WelcomeStyle { pub struct WelcomeStyle {
pub page_width: f32, pub page_width: f32,
pub logo: IconStyle,
pub logo_subheading: ContainedText, pub logo_subheading: ContainedText,
pub checkbox: CheckboxStyle, pub checkbox: CheckboxStyle,
pub button: Interactive<ContainedText>, pub button: Interactive<ContainedText>,
@ -863,6 +864,19 @@ pub struct WelcomeStyle {
pub checkbox_group: ContainerStyle, pub checkbox_group: ContainerStyle,
} }
#[derive(Clone, Deserialize, Default)]
pub struct IconStyle {
pub color: Color,
pub icon: String,
pub dimensions: Dimensions,
}
#[derive(Clone, Deserialize, Default)]
pub struct Dimensions {
pub width: f32,
pub height: f32,
}
#[derive(Clone, Deserialize, Default)] #[derive(Clone, Deserialize, Default)]
pub struct CheckboxStyle { pub struct CheckboxStyle {
pub check_icon: String, pub check_icon: String,

View file

@ -3,7 +3,7 @@ mod base_keymap_picker;
use std::borrow::Cow; use std::borrow::Cow;
use gpui::{ use gpui::{
elements::{Empty, Flex, Image, Label, MouseEventHandler, ParentElement, Svg}, elements::{Empty, Flex, Label, MouseEventHandler, ParentElement, Svg},
Action, Element, ElementBox, Entity, MouseButton, MutableAppContext, RenderContext, Action, Element, ElementBox, Entity, MouseButton, MutableAppContext, RenderContext,
Subscription, View, ViewContext, Subscription, View, ViewContext,
}; };
@ -56,10 +56,11 @@ impl View for WelcomePage {
.with_children([ .with_children([
Flex::column() Flex::column()
.with_children([ .with_children([
Image::new("images/zed-logo-90x90.png") Svg::new(theme.welcome.logo.icon.clone())
.with_color(theme.welcome.logo.color)
.constrained() .constrained()
.with_width(90.) .with_width(theme.welcome.logo.dimensions.width)
.with_height(90.) .with_height(theme.welcome.logo.dimensions.height)
.aligned() .aligned()
.contained() .contained()
.aligned() .aligned()
@ -75,8 +76,10 @@ impl View for WelcomePage {
]) ])
.contained() .contained()
.with_style(theme.welcome.heading_group) .with_style(theme.welcome.heading_group)
.constrained()
.with_width(width)
.boxed(), .boxed(),
Flex::row() Flex::column()
.with_children([ .with_children([
self.render_cta_button( self.render_cta_button(
"Choose a theme", "Choose a theme",
@ -99,6 +102,8 @@ impl View for WelcomePage {
]) ])
.contained() .contained()
.with_style(theme.welcome.button_group) .with_style(theme.welcome.button_group)
.constrained()
.with_width(width)
.boxed(), .boxed(),
Flex::column() Flex::column()
.with_children([ .with_children([
@ -119,6 +124,8 @@ impl View for WelcomePage {
]) ])
.contained() .contained()
.with_style(theme.welcome.checkbox_group) .with_style(theme.welcome.checkbox_group)
.constrained()
.with_width(width)
.boxed(), .boxed(),
]) ])
.constrained() .constrained()

View file

@ -1,5 +1,6 @@
import { ColorScheme } from "../themes/common/colorScheme"; import { ColorScheme } from "../themes/common/colorScheme";
import { withOpacity } from "../utils/color";
import { border, background, foreground, text, TextProperties } from "./components"; import { border, background, foreground, text, TextProperties } from "./components";
@ -27,50 +28,61 @@ export default function welcome(colorScheme: ColorScheme) {
return { return {
pageWidth: 320, pageWidth: 320,
logo: {
color: foreground(layer, "default"),
icon: "icons/logo_96.svg",
dimensions: {
width: 64,
height: 64,
}
},
logoSubheading: { logoSubheading: {
...text(layer, "sans", { size: "lg" }), ...text(layer, "sans", "variant", { size: "md" }),
margin: { margin: {
top: 10, top: 10,
bottom: 7, bottom: 7,
}, },
}, },
buttonGroup: { buttonGroup: {
border: border(layer, "active"),
margin: { margin: {
top: 8, top: 8,
bottom: 7 bottom: 16
}, },
}, },
headingGroup: { headingGroup: {
margin: { margin: {
top: 8, top: 8,
bottom: 7 bottom: 12
}, },
}, },
checkboxGroup: { checkboxGroup: {
margin: { border: border(layer, "variant"),
top: 8, background: withOpacity(background(layer, "hovered"), 0.25),
bottom: 7 cornerRadius: 4,
padding: {
left: 12,
top: 2,
bottom: 2
}, },
}, },
button: { button: {
background: background(layer), background: background(layer),
border: border(layer, "default"), border: border(layer, "active"),
cornerRadius: 4, cornerRadius: 4,
margin: { margin: {
top: 8, top: 4,
bottom: 7 bottom: 4
}, },
padding: { padding: {
top: 1, top: 3,
bottom: 1, bottom: 3,
left: 7, left: 7,
right: 7, right: 7,
}, },
...text(layer, "sans", "default", interactive_text_size), ...text(layer, "sans", "default", interactive_text_size),
hover: { hover: {
...text(layer, "sans", "default", interactive_text_size), ...text(layer, "sans", "default", interactive_text_size),
background: background(layer, "default"), background: background(layer, "hovered"),
border: border(layer, "active"), border: border(layer, "active"),
}, },
}, },
@ -81,7 +93,7 @@ export default function welcome(colorScheme: ColorScheme) {
}, },
container: { container: {
margin: { margin: {
top: 5, top: 4,
}, },
}, },
width: 12, width: 12,
@ -101,7 +113,7 @@ export default function welcome(colorScheme: ColorScheme) {
hovered: { hovered: {
...checkboxBase, ...checkboxBase,
background: background(layer, "hovered"), background: background(layer, "hovered"),
border: border(layer, "hovered") border: border(layer, "active")
}, },
hoveredAndChecked: { hoveredAndChecked: {
...checkboxBase, ...checkboxBase,