gpui-kit GitHub

Scenes

date-time

Builds Button Calendar DateInput Overlay RangePicker TimeInput

date-time in the dark theme
studio-dark
date-time in the light theme
studio-light

The code that drew it

A still frame holds a repeating animation at its first frame and a one-shot at its last, because a still of a moving thing is not reproducible. Run the gallery to review motion.

    pub(super) fn date_time(window: &mut Window, cx: &mut App) -> AnyElement {
        ensure(window, cx);
        let theme = cx.theme().clone();
        let dates = cx.global::<SceneDates>();
        let (field, refused, clock, twelve) = (
            dates.field.clone(),
            dates.refused.clone(),
            dates.clock.clone(),
            dates.twelve.clone(),
        );
        stack(&theme)
            .child(div().w(px(280.0)).child(field))
            .child(div().w(px(280.0)).child(refused))
            .child(
                row(&theme)
                    .gap(px(theme.space(Space::Lg)))
                    .child(clock)
                    .child(twelve),
            )
            .child(
                div()
                    .max_w(px(560.0))
                    .text_color(theme.colors.text_muted)
                    .child(
                        "What the field could not read is still in it, and the refusal is the \
                         adapter's own sentence.",
                    ),
            )
            .into_any_element()
    }