plate-tool/src/components/plates/plate_container.rs

38 lines
1.1 KiB
Rust
Raw Normal View History

2023-05-21 16:45:12 +00:00
#![allow(non_snake_case)]
use yew::prelude::*;
2023-05-24 15:20:12 +00:00
2023-05-24 20:10:33 +00:00
use crate::data::plate_instances::PlateInstance;
2023-05-24 15:20:12 +00:00
use super::source_plate::SourcePlate;
2023-05-21 16:45:12 +00:00
use super::destination_plate::DestinationPlate;
#[derive(Properties, PartialEq)]
pub struct PlateContainerProps {
2023-05-24 20:10:33 +00:00
pub source_dims: Option<PlateInstance>,
pub destination_dims: Option<PlateInstance>,
}
2023-05-21 16:45:12 +00:00
#[function_component]
pub fn PlateContainer(props: &PlateContainerProps) -> Html {
html! {
<div class="plate_container">
2023-05-24 20:10:33 +00:00
if let Some(spi) = props.source_dims.clone() {
2023-05-24 22:39:38 +00:00
if let Some(dpi) = props.destination_dims.clone() {
2023-05-24 20:10:33 +00:00
<div>
<h2>{spi.name.clone()}</h2>
2023-05-24 22:39:38 +00:00
<SourcePlate source_plate={spi.clone()} destination_plate={dpi.clone()} />
2023-05-24 20:10:33 +00:00
</div>
<div>
<h2>{dpi.name.clone()}</h2>
2023-05-24 22:39:38 +00:00
<DestinationPlate source_plate={spi.clone()} destination_plate={dpi.clone()} />
2023-05-24 20:10:33 +00:00
</div>
2023-05-24 15:42:54 +00:00
} else {
<h2>{"No Destination Plate Selected"}</h2>
}
2023-05-24 22:39:38 +00:00
} else {
<h2>{"No Source Plate Selected"}</h2>
}
</div>
}
2023-05-21 16:45:12 +00:00
}