Skip to main content

freya_components/icons/
cross.rs

1use dioxus::prelude::*;
2use freya_elements as dioxus_elements;
3use freya_hooks::{
4    use_applied_theme,
5    IconTheme,
6    IconThemeWith,
7};
8
9/// Properties for the [`CrossIcon`] component.
10#[derive(Props, Clone, PartialEq)]
11pub struct CrossIconProps {
12    /// Theme override.
13    pub theme: Option<IconThemeWith>,
14    /// Color.
15    #[props(into)]
16    pub fill: String,
17}
18
19/// Icon component for a Cross.
20#[allow(non_snake_case)]
21pub fn CrossIcon(CrossIconProps { theme, fill }: CrossIconProps) -> Element {
22    let IconTheme {
23        height,
24        width,
25        margin,
26    } = use_applied_theme!(&theme, icon);
27
28    rsx!(svg {
29        height: "{height}",
30        width: "{width}",
31        margin: "{margin}",
32        svg_content: r#"
33            <svg viewBox="0 0 292 292" fill="none" xmlns="http://www.w3.org/2000/svg">
34                <path d="M0.0366211 268.737L268.737 0.0366211L291.365 22.664L22.664 291.365L0.0366211 268.737Z" fill="{fill}"/>
35                <path d="M268.737 291.365L0.0366211 22.664L22.664 0.0366211L291.365 268.737L268.737 291.365Z" fill="{fill}"/>
36            </svg>
37        "#
38    })
39}