tailwind_css/modules/transforms/rotate/
mod.rs1use super::*;
2
3#[doc=include_str!("readme.md")]
4#[derive(Clone, Debug)]
5pub struct TailwindRotate {
6 kind: UnitValue,
7}
8
9impl Display for TailwindRotate {
10 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
11 self.kind.write_negative(f)?;
12 self.kind.write_class(f, "rotate-")
13 }
14}
15
16impl TailwindInstance for TailwindRotate {
17 fn attributes(&self, _: &TailwindBuilder) -> CssAttributes {
18 let deg = self.kind.get_properties(|f| format!("{}deg", f));
19 let transform = format!("rotate({})", deg);
20 css_attributes! {
21 "transform" => transform,
22 }
23 }
24}
25
26impl TailwindRotate {
27 pub fn parse(input: &[&str], arbitrary: &TailwindArbitrary, negative: Negative) -> Result<Self> {
29 let kind = UnitValue::negative_parser("scale", |_| false, false, false, false)(input, arbitrary, negative)?;
30 Ok(Self { kind })
31 }
32}