1use yew::prelude::{html, Component, Context, Html, Properties};
8
9pub struct QrCode {}
10
11#[derive(Properties, Debug, Clone, PartialEq, Eq)]
12pub struct Props {
13 #[prop_or_default]
14 pub class: Option<&'static str>,
15
16 #[prop_or_default]
17 pub width: Option<&'static str>,
18
19 #[prop_or_default]
20 pub height: Option<&'static str>,
21
22 #[prop_or_default]
23 pub color: Option<&'static str>,
24
25 #[prop_or_default]
26 pub fill: Option<&'static str>,
27
28 #[prop_or_default]
29 pub spin: bool,
30
31 #[prop_or_default]
32 pub rotate: i16,
33}
34
35impl Component for QrCode {
36 type Properties = Props;
37 type Message = ();
38
39 fn create(_ctx: &Context<Self>) -> Self {
40 Self {}
41 }
42
43 fn view(&self, ctx: &Context<Self>) -> Html {
44 let props = ctx.props();
45 let mut style = String::new();
47 if props.rotate != 0 {
48 style += &format!("transform: rotate({}deg);", props.rotate);
49 }
50 html! {
51 <svg
52 xmlns={ "http://www.w3.org/2000/svg" }
53 class={ props.class.unwrap_or("") }
54 width={ props.width.unwrap_or("16") }
55 height={ props.height.unwrap_or("16") }
56 focusable={ "false" }
57 data-icon={ "qr-code" }
58 viewBox={ "0 0 16 16" }
59 fill={ props.fill.unwrap_or("currentColor") }
60 style={ style }
61 >
62 <path d="M2 2h2v2H2z"/>
63 <path d="M6 0v6H0V0zM5 1H1v4h4zM4 12H2v2h2z"/>
64 <path d="M6 10v6H0v-6zm-5 1v4h4v-4zm11-9h2v2h-2z"/>
65 <path d="M10 0v6h6V0zm5 1v4h-4V1zM8 1V0h1v2H8v2H7V1zm0 5V4h1v2zM6 8V7h1V6h1v2h1V7h5v1h-4v1H7V8zm0 0v1H2V8H1v1H0V7h3v1zm10 1h-1V7h1zm-1 0h-1v2h2v-1h-1zm-4 0h2v1h-1v1h-1zm2 3v-1h-1v1h-1v1H9v1h3v-2zm0 0h3v1h-2v1h-1zm-4-1v1h1v-2H7v1z"/>
66 <path d="M7 12h1v3h4v1H7zm9 2v2h-3v-1h2v-1z"/>
67 </svg>
68 }
69 }
70}