PR with too many features #58
No files matched your search
@@ -20,7 +20,7 @@ fn validate(required: bool, value: String) -> ValidationState {
|
||||
/// by the `value` prop of the component.
|
||||
#[component]
|
||||
pub fn Select(
|
||||
#[prop()] value_list: Vec<String>,
|
||||
#[prop(into)] value_list: Signal<Vec<String>>,
|
||||
#[prop(into)] data_member: Signal<String>,
|
||||
#[prop()] data_map: RwSignal<HashMap<String, ValueType>>,
|
||||
#[prop(optional, into)] label: String,
|
||||
@@ -110,6 +110,7 @@ pub fn Select(
|
||||
</option>
|
||||
{move || {
|
||||
value_list
|
||||
.get()
|
||||
.iter()
|
||||
.map(move |value| {
|
||||
let display = value.to_owned();
|
||||
|
||||
@@ -65,6 +65,8 @@ fn new_entry() -> ValueType {
|
||||
/// `first_name` and `last_name` keys within that `Entry`.
|
||||
#[component]
|
||||
pub fn MultiEntry(
|
||||
#[prop(into)] label: Signal<String>,
|
||||
#[prop(optional, into)] description: Signal<String>,
|
||||
/// The data member that contains the list of entries within the `data_map`.
|
||||
#[prop(into)]
|
||||
data_member: String,
|
||||
@@ -101,7 +103,11 @@ pub fn MultiEntry(
|
||||
let add_entry = move |_| data_reactive.update(|list| list.push(new_entry()));
|
||||
|
||||
view! {
|
||||
<div class="flex flex-col flex-1">
|
||||
<div class="flex flex-col flex-1 gap-2">
|
||||
<span class="font-bold">{label}</span>
|
||||
<Show when=move || !description.get().is_empty()>
|
||||
<span>{description}</span>
|
||||
</Show>
|
||||
<div class="flex flex-col gap-2 p-2">
|
||||
// Render the entries
|
||||
<For
|
||||
|
||||
+2
-14
@@ -12,7 +12,7 @@ use crate::common::ExpandableInfo;
|
||||
use crate::pages::UnauthenticatedPage;
|
||||
use crate::components::{
|
||||
ActionButton, CheckboxList, Loading, MultiEntry, OutlinedTextField, Panel, RadioList, Row,
|
||||
Select, TextFieldType, ValidatedForm
|
||||
TextFieldType, ValidatedForm
|
||||
};
|
||||
use crate::input;
|
||||
use leptos::leptos_dom::logging::console_log;
|
||||
@@ -329,21 +329,9 @@ pub fn HomePage() -> impl IntoView {
|
||||
required=true
|
||||
/>
|
||||
</Row>
|
||||
<Row>
|
||||
<Select
|
||||
label="Gender:"
|
||||
value_list=vec!["Male", "Female", "Prefer not to answer"]
|
||||
.into_iter()
|
||||
.map(|s| s.to_owned())
|
||||
.collect()
|
||||
disabled=elements_disabled
|
||||
data_member="gender"
|
||||
data_map=form_data
|
||||
required=true
|
||||
/>
|
||||
</Row>
|
||||
<Row>
|
||||
<MultiEntry
|
||||
label="Testing community involvement:"
|
||||
data_map=form_data
|
||||
data_member="community_involvement"
|
||||
schema=vec![
|
||||
|
||||
@@ -12,6 +12,8 @@ pub fn StudentAthleticsPage() -> impl IntoView {
|
||||
<div class="flex flex-col flex-2 mt-6">
|
||||
<ValidatedForm title="Athletics Information" on_submit=move || {}>
|
||||
<MultiEntry
|
||||
label="Athletics Activities:"
|
||||
description="Leave blank if not applicable."
|
||||
data_map=data_map
|
||||
data_member="athletic_participation"
|
||||
schema=vec![
|
||||
|
||||
@@ -21,6 +21,8 @@ pub fn StudentExtracurricularsPage() -> impl IntoView {
|
||||
required=true
|
||||
/>
|
||||
<MultiEntry
|
||||
label="Extracurricular Activities:"
|
||||
description="Leave blank if not applicable."
|
||||
data_map=data_map
|
||||
data_member="extracurricular"
|
||||
schema=vec![
|
||||
|
||||
@@ -12,6 +12,8 @@ pub fn StudentWorkExperiencePage() -> impl IntoView {
|
||||
<div class="flex flex-col flex-2 mt-6">
|
||||
<ValidatedForm title="Student Work Experience" on_submit=move || {}>
|
||||
<MultiEntry
|
||||
label="Work Experience:"
|
||||
description="Leave blank if not applicable."
|
||||
data_map=data_map
|
||||
data_member="extracurricular"
|
||||
schema=vec![
|
||||
|
||||
Reference in new issue
Block a user