edc_web_components/pages/
new_policy_page.rs1use crate::components::CreatePolicy;
2use patternfly_yew::prelude::*;
3use yew::prelude::*;
4
5#[derive(Clone, Debug, PartialEq, Properties)]
6pub struct NewPolicyPageProps {
7 #[prop_or("New Policy".to_string())]
8 pub title: String,
9 #[prop_or(Some("Policies define the rules and conditions that govern the use of your data. You can add as many rules as required.".to_string()))]
10 pub tag_line: Option<String>,
11 pub on_create: Callback<()>,
12}
13
14#[component]
15pub fn NewPolicyPage(props: &NewPolicyPageProps) -> Html {
16 let tag_line = props
17 .tag_line
18 .as_ref()
19 .map(|tag_line| html!(<p>{ tag_line }</p>))
20 .unwrap_or_default();
21
22 html!(
23 <>
24 <Title level={Level::H2} size={Size::XXXLarge}>{ &props.title }</Title>
25 { tag_line }
26 <CreatePolicy on_create={props.on_create.clone()} />
27 </>
28 )
29}