Dashboard button #25

Merged
meraghon merged 8 commits from feat/dashboard-button into main 2025-12-05 13:35:07 +00:00
Showing only changes of commit 0379ef3fb3 - Show all commits
+14 -6
View File
@@ -1,11 +1,11 @@
use leptos::prelude::*;
BobdaFett commented 2025-11-27 21:22:23 +00:00 (Migrated from github.com)
Review

These should not be Optional values. When we use #[prop(optional), it just means that we either have a value, or the default value. For something like this (a String) that would mean we either have a specific value passed in or just the empty string.

These should not be Optional values. When we use `#[prop(optional)`, it just means that we either have a value, or the default value. For something like this (a String) that would mean we either have a specific value passed in or just the empty string.
BobdaFett commented 2025-11-27 21:23:30 +00:00 (Migrated from github.com)
Review

Setting up the #[prop] the right way above should mean that you just print the string value here, no mapping needed.

Setting up the `#[prop]` the right way above should mean that you just print the string value here, no mapping needed.
BobdaFett commented 2025-11-27 21:26:03 +00:00 (Migrated from github.com)
Review

Depending on your desired behavior, leaving this as an Option<String> might be fine. What I'd like to know is the mindset behind it - if this is a None value, how are you handling it? Should this even be optional at all? Why?

I'd recommend documenting this properly (refer to Leptos documentation for how to add doc comments to components).

Depending on your desired behavior, leaving this as an `Option<String>` might be fine. What I'd like to know is the mindset behind it - if this is a `None` value, how are you handling it? Should this even be optional at all? Why? I'd recommend documenting this properly (refer to Leptos documentation for how to add doc comments to components).
BobdaFett commented 2025-12-05 13:07:30 +00:00 (Migrated from github.com)
Review

These props should also have comments. They just have the /// comment one line above.

These props should also have comments. They just have the `/// comment` one line above.
BobdaFett commented 2025-12-05 13:08:03 +00:00 (Migrated from github.com)
Review

There should always be a space after the # in headers.

There should always be a space after the `#` in headers.
use leptos_router::hooks::use_navigate;
/// #Dashboard Button Component
/// # Dashboard Button Component
///
/// This component displays a large panel-like button that redirects a user to a specified page.
/// It's best used on a user dashboard, where multiple instances of the button are present.
/// It has a title, description, and icon
/// It has a title, a description, and icon
///
/// Example usage:
/// ```
@@ -20,10 +20,18 @@ use leptos_router::hooks::use_navigate;
/// ```
#[component]
pub fn DashboardButton(
BobdaFett commented 2025-11-27 21:28:40 +00:00 (Migrated from github.com)
Review

This whole component needs documentation - at least give a title to the component, a brief description, explain the props, and a usage example. This is included with other components that have been created, specifically the selection lists (ChipsList, CheckboxList, etc.).

This whole component needs documentation - at least give a title to the component, a brief description, explain the props, and a usage example. This is included with other components that have been created, specifically the selection lists (`ChipsList`, `CheckboxList`, etc.).
#[prop(into)] title: String,
#[prop(into)] description: String,
#[prop(into)] icon: String,
#[prop(into)] path: String,
/// The main label displayed on the button.
#[prop(into)]
title: String,
/// A brief explanatory text that describes the destination page.
#[prop(into)]
description: String,
/// The file path or URL of the icon displayed at the top of the button.
#[prop(into)]
icon: String,
/// The route that the user is navigated to when clicking the button.
#[prop(into)]
path: String,
) -> impl IntoView {
let navigate = use_navigate();