Extract UI elements from storybook into new ui crate (#3008)

This PR extracts the various UI elements from the `storybook` crate into
a new `ui` library crate.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2023-09-21 19:25:35 -04:00 committed by GitHub
parent c252eae32e
commit baa07e935e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 154 additions and 117 deletions

55
crates/ui/src/prelude.rs Normal file
View file

@ -0,0 +1,55 @@
#[derive(Default, PartialEq)]
pub enum ButtonVariant {
#[default]
Ghost,
Filled,
}
#[derive(Default, PartialEq)]
pub enum InputVariant {
#[default]
Ghost,
Filled,
}
#[derive(Default, PartialEq, Clone, Copy)]
pub enum Shape {
#[default]
Circle,
RoundedRectangle,
}
#[derive(Default, PartialEq, Clone, Copy)]
pub enum InteractionState {
#[default]
Enabled,
Hovered,
Active,
Focused,
Dragged,
Disabled,
}
impl InteractionState {
pub fn if_enabled(&self, enabled: bool) -> Self {
if enabled {
*self
} else {
InteractionState::Disabled
}
}
}
#[derive(Default, PartialEq)]
pub enum SelectedState {
#[default]
Unselected,
PartiallySelected,
Selected,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum ToggleState {
Toggled,
NotToggled,
}