-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
296 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
102 changes: 102 additions & 0 deletions
102
packages/components/src/data/paragraph/typography/sizing.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
use stylist::yew::styled_component; | ||
use yew::prelude::*; | ||
|
||
use hikari_theme::types::FontSize; | ||
|
||
#[derive(Properties, Debug, PartialEq)] | ||
pub struct Props { | ||
#[prop_or_default] | ||
pub children: Children, | ||
#[prop_or(FontSize::H1)] | ||
pub size: FontSize, | ||
} | ||
|
||
/// `<Sizing>` component can be used to set the font size. | ||
#[styled_component] | ||
pub fn Sizing(props: &Props) -> Html { | ||
html! { | ||
<div | ||
class={css!(r#" | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
"#)} | ||
> | ||
{props.children.clone()} | ||
</div> | ||
} | ||
} | ||
|
||
pub mod headers { | ||
use stylist::yew::styled_component; | ||
use yew::prelude::*; | ||
|
||
use super::Sizing; | ||
use hikari_theme::types::FontSize; | ||
|
||
#[derive(Properties, Debug, PartialEq)] | ||
pub struct Props { | ||
#[prop_or_default] | ||
pub children: Children, | ||
} | ||
|
||
/// `<H1>` component is like a `<h1>` element in HTML. | ||
#[styled_component] | ||
pub fn H1(props: &Props) -> Html { | ||
html! { | ||
<Sizing size={FontSize::H1}> | ||
{props.children.clone()} | ||
</Sizing> | ||
} | ||
} | ||
|
||
/// `<H2>` component is like a `<h2>` element in HTML. | ||
#[styled_component] | ||
pub fn H2(props: &Props) -> Html { | ||
html! { | ||
<Sizing size={FontSize::H2}> | ||
{props.children.clone()} | ||
</Sizing> | ||
} | ||
} | ||
|
||
/// `<H3>` component is like a `<h3>` element in HTML. | ||
#[styled_component] | ||
pub fn H3(props: &Props) -> Html { | ||
html! { | ||
<Sizing size={FontSize::H3}> | ||
{props.children.clone()} | ||
</Sizing> | ||
} | ||
} | ||
|
||
/// `<H4>` component is like a `<h4>` element in HTML. | ||
#[styled_component] | ||
pub fn H4(props: &Props) -> Html { | ||
html! { | ||
<Sizing size={FontSize::H4}> | ||
{props.children.clone()} | ||
</Sizing> | ||
} | ||
} | ||
|
||
/// `<H5>` component is like a `<h5>` element in HTML. | ||
#[styled_component] | ||
pub fn H5(props: &Props) -> Html { | ||
html! { | ||
<Sizing size={FontSize::H5}> | ||
{props.children.clone()} | ||
</Sizing> | ||
} | ||
} | ||
|
||
/// `<H6>` component is like a `<h6>` element in HTML. | ||
#[styled_component] | ||
pub fn H6(props: &Props) -> Html { | ||
html! { | ||
<Sizing size={FontSize::H6}> | ||
{props.children.clone()} | ||
</Sizing> | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use yuuka::derive_enum; | ||
|
||
derive_enum!( | ||
#[derive(PartialEq, Serialize, Deserialize)] | ||
pub enum ComponentType { | ||
Container(enum Container { | ||
Layout(enum Layout { | ||
Aside, | ||
Container, | ||
Main, | ||
Header, | ||
Footer, | ||
}), | ||
Place(enum Place { | ||
Column, | ||
Row, | ||
Grid, | ||
Space, | ||
Divider, | ||
Skeleton, | ||
}), | ||
System(enum System { | ||
Flex, | ||
Anchor, | ||
Modal, | ||
Scrollable, | ||
Resizable, | ||
Draggable, | ||
Cursor, | ||
Breakpoint, | ||
}) | ||
}), | ||
Data(enum Data { | ||
Block(enum Block { | ||
List, | ||
Progress, | ||
Tree, | ||
Paper, | ||
Card, | ||
Carousel, | ||
Collapse, | ||
Masonry, | ||
}), | ||
Media(enum Media { | ||
Image, | ||
Charts, | ||
Scene, | ||
}), | ||
Paragraph(enum Paragraph { | ||
Typography(enum Typography { | ||
Sub, | ||
Sup, | ||
Bold, | ||
Code, | ||
Sample, | ||
Delete, | ||
IsolateDirection, | ||
OverrideDirection, | ||
Italic, | ||
Mark, | ||
BlockQuote, | ||
Quote, | ||
Ruby, | ||
Size, | ||
Sizing, | ||
Divider, | ||
Split, | ||
Underline, | ||
}), | ||
Rich, | ||
Affix, | ||
Avatar, | ||
Badge, | ||
Chip, | ||
Icon, | ||
}) | ||
}), | ||
Form(enum Form { | ||
Button(enum Button { | ||
Button, | ||
IconButton, | ||
ButtonGroup, | ||
Tag, | ||
}), | ||
Input(enum Input { | ||
Text, | ||
TextArea, | ||
Rich, | ||
}), | ||
Picker(enum Picker { | ||
Color, | ||
File, | ||
Date, | ||
Time, | ||
DateTime, | ||
}), | ||
Selector(enum Selector { | ||
MultiSelect, | ||
CheckBox, | ||
Radio, | ||
Select, | ||
Switch, | ||
Slider, | ||
Range, | ||
Rating, | ||
}), | ||
}), | ||
Navigation(enum Navigation { | ||
Aside(enum Aside { | ||
Nav(enum Nav { | ||
TopNav, | ||
BottomNav, | ||
}), | ||
Breadcrumb, | ||
Pagination, | ||
Steps, | ||
Tabs, | ||
}), | ||
Modal(enum Modal { | ||
Drawer, | ||
Menu, | ||
MessageBox, | ||
Notification, | ||
Popover, | ||
SpeddDial, | ||
Tooltip, | ||
}) | ||
}) | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#[derive(Debug, Clone, PartialEq)] | ||
pub struct ComponentSkin { | ||
pub style: stylist::StyleSource, | ||
pub extra_division: Vec<stylist::StyleSource>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// TODO: Allow to add more custom transitions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// TODO: fonts, scales and default font size | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq)] | ||
pub enum FontSize { | ||
H1, | ||
H2, | ||
H3, | ||
H4, | ||
H5, | ||
H6, | ||
Px(f64), | ||
Em(f64), | ||
Rem(f64), | ||
Custom(&'static str), | ||
} |
Oops, something went wrong.