|
| 1 | +use dioxus::prelude::*; |
| 2 | +#[derive(Clone, PartialEq, Props)] |
| 3 | +pub struct GitMergeConflictProps { |
| 4 | + #[props(default = 24)] |
| 5 | + pub size: usize, |
| 6 | + #[props(default = "currentColor".to_owned())] |
| 7 | + pub color: String, |
| 8 | + #[props(default = "none".to_owned())] |
| 9 | + pub fill: String, |
| 10 | + #[props(default = 2)] |
| 11 | + pub stroke_width: usize, |
| 12 | + #[props(default = false)] |
| 13 | + pub absolute_stroke_width: bool, |
| 14 | + pub class: Option<String>, |
| 15 | + pub style: Option<String>, |
| 16 | +} |
| 17 | +#[component] |
| 18 | +pub fn GitMergeConflict(props: GitMergeConflictProps) -> Element { |
| 19 | + let stroke_width = if props.absolute_stroke_width { |
| 20 | + props.stroke_width * 24 / props.size |
| 21 | + } else { |
| 22 | + props.stroke_width |
| 23 | + }; |
| 24 | + rsx! { |
| 25 | + svg { |
| 26 | + "xmlns": "http://www.w3.org/2000/svg", |
| 27 | + "class": if let Some(class) = props.class { "{class}" }, |
| 28 | + "style": if let Some(style) = props.style { "{style}" }, |
| 29 | + "width": "{props.size}", |
| 30 | + "height": "{props.size}", |
| 31 | + "viewBox": "0 0 24 24", |
| 32 | + "fill": "{props.fill}", |
| 33 | + "stroke": "{props.color}", |
| 34 | + "stroke-width": "{stroke_width}", |
| 35 | + "stroke-linecap": "round", |
| 36 | + "stroke-linejoin": "round", |
| 37 | + path { "d": "M12 6h4a2 2 0 0 1 2 2v7" } |
| 38 | + path { "d": "M6 12v9" } |
| 39 | + path { "d": "M9 3 3 9" } |
| 40 | + path { "d": "M9 9 3 3" } |
| 41 | + circle { "cx": "18", "cy": "18", "r": "3" } |
| 42 | + } |
| 43 | + } |
| 44 | +} |
0 commit comments