elevated_surface.rs

 1use gpui::Div;
 2
 3use crate::{prelude::*, v_stack};
 4
 5/// Create an elevated surface.
 6///
 7/// Must be used inside of a relative parent element
 8pub fn elevated_surface<V: 'static>(level: ElevationIndex, cx: &mut ViewContext<V>) -> Div<V> {
 9    let colors = cx.theme().colors();
10
11    // let shadow = BoxShadow {
12    //     color: hsla(0., 0., 0., 0.1),
13    //     offset: point(px(0.), px(1.)),
14    //     blur_radius: px(3.),
15    //     spread_radius: px(0.),
16    // };
17
18    v_stack()
19        .rounded_lg()
20        .bg(colors.elevated_surface_background)
21        .border()
22        .border_color(colors.border)
23        .shadow(level.shadow())
24}
25
26pub fn modal<V: 'static>(cx: &mut ViewContext<V>) -> Div<V> {
27    elevated_surface(ElevationIndex::ModalSurface, cx)
28}