diff --git a/gatsby-node.js b/gatsby-node.js index 1fd9d3eb694b9..bf96eed7e0d2f 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -727,10 +727,6 @@ exports.createPages = async ({ actions, graphql, reporter }) => { }); const components = componentsData.map((component) => component.src.replace("/", "")); - - - - const createComponentPages = (createPage, components) => { const pageTypes = [ { suffix: "", file: "index.js" }, diff --git a/src/components/handbook-navigation/TocPagination.js b/src/components/handbook-navigation/TocPagination.js index f70d04bf7477a..953f70412b3cd 100644 --- a/src/components/handbook-navigation/TocPagination.js +++ b/src/components/handbook-navigation/TocPagination.js @@ -22,7 +22,7 @@ const TocPagination = () => { ) : null} {currentPage < content.length - 1 ? ( - ) : null} diff --git a/src/sections/Projects/Sistent/components/content.js b/src/sections/Projects/Sistent/components/content.js index d9356ad7b29df..ca8d04d14ab43 100644 --- a/src/sections/Projects/Sistent/components/content.js +++ b/src/sections/Projects/Sistent/components/content.js @@ -19,7 +19,7 @@ const componentsData = [ id: 3, name: "Modal", description: - "A modal is a dialog box/popup that is displayed over the main content to present information or collect input.", + "A text input is made up of multiple elements that combine to form a component that helps users to read, write, and edit text in an interface.", url: "/projects/sistent/components/modal", src: "/modal", }, diff --git a/src/sections/Projects/Sistent/components/toggle-button/code.js b/src/sections/Projects/Sistent/components/toggle-button/code.js index c30eac52cf2dc..bacbae0df92b7 100644 --- a/src/sections/Projects/Sistent/components/toggle-button/code.js +++ b/src/sections/Projects/Sistent/components/toggle-button/code.js @@ -13,64 +13,87 @@ import TabButton from "../../../../../reusecore/Button"; import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode"; const codes = [ - ` - - Toggle On - - `, - ` + // For exclusive selection + ` console.log(value)} > - Option 1 - Option 2 + Left + Center + Right - `, - ` + `, + // For multiple selection + ` console.log(value)} + value={["bold", "italic"]} > - Option 1 - Option 2 - Option 3 + Bold + Italic + Underline - `, - ` + `, + // For size + ` Small Small - `, - ` + + Medium + Medium + Large Large - `, - ` - - Primary - Secondary + `, + // For color + ` + + Primary + Secondary + + `, + // For vertical + ` + + Vertical 1 + Vertical 2 + Vertical 3 - `, + `, ]; const ToggleButtonCode = () => { const { isDark } = useStyledDarkMode(); const location = useLocation(); - const [selected, setSelected] = useState("option1"); - const [multiSelected, setMultiSelected] = useState(["option1"]); - - const handleSingleToggle = (event, value) => { - setSelected(value); + const [exclusiveSelected, setExclusiveSelected] = useState("left"); + const [multiSelected, setMultiSelected] = useState(["bold"]); + const [sizeSelected, setSizeSelected] = useState("small"); + const [colorSelected, setColorSelected] = useState("primary"); + const [verticalSelected, setVerticalSelected] = useState("left"); + const handleExclusiveToggle = (event, value) => { + setExclusiveSelected(value); }; const handleMultiToggle = (event, value) => { setMultiSelected(value); }; + const handleSizeToggle = (event, value) => { + setSizeSelected(value); + }; + const handleColorToggle = (event, value) => { + setColorSelected(value); + }; + const handleVerticalToggle = (event, value) => { + setVerticalSelected(value); + }; return ( @@ -124,56 +147,29 @@ const ToggleButtonCode = () => { />
- -

Single ToggleButton

-
-

- A single `ToggleButton` is used to toggle between two states. Here - is an example: -

-
-
- - - Toggle On - - -
- -
- - -

Grouped ToggleButtons (Single Selection)

+
+

Exclusive Selection

-

- Use a `ToggleButtonGroup` to group related buttons for single - selection. The `exclusive` prop ensures that only one button can be - selected at a time. -

- Option 1 - Option 2 + Left + Center + Right
- +
- -

Grouped ToggleButtons (Multiple Selection)

+
+

Multiple Selection

-

- Use `ToggleButtonGroup` without the `exclusive` prop to allow users - to select multiple options within a group. This approach is useful - when enabling combinations of settings. -

@@ -181,55 +177,76 @@ const ToggleButtonCode = () => { value={multiSelected} onChange={handleMultiToggle} > - Option 1 - Option 2 - Option 3 + Bold + Italic + Underline
- +
- +

ToggleButton Sizes

- Adjust the size of the `ToggleButton` using the `size` prop. Supported values include - `small`, `medium`, and `large`. + Adjust the size of the `ToggleButton` using the `size` prop. + Supported values include `small`, `medium`, and `large`.

- + Small Small - + + Medium + Medium + + Large Large
- +
- +

ToggleButton Colors

-

- Use the `color` prop to set the color scheme for the `ToggleButton`. Common values include - `primary`, `secondary`, and `default`. -

- - Primary - Secondary + + Primary + Secondary + + +
+ +
+ + +

Vertical Buttons

+
+
+
+ + + Vertical 1 + Vertical 2 + Vertical 3
- +
diff --git a/src/sections/Projects/Sistent/components/toggle-button/guidance.js b/src/sections/Projects/Sistent/components/toggle-button/guidance.js index 05dc4985ab15c..736fe7b5f240f 100644 --- a/src/sections/Projects/Sistent/components/toggle-button/guidance.js +++ b/src/sections/Projects/Sistent/components/toggle-button/guidance.js @@ -2,9 +2,12 @@ import React from "react"; import { navigate } from "gatsby"; import { useLocation } from "@reach/router"; import { Row } from "../../../../../reusecore/Layout"; -import { ToggleButton, ToggleButtonGroup, SistentThemeProvider } from "@layer5/sistent"; +import { + ToggleButton, + ToggleButtonGroup, + SistentThemeProvider, +} from "@layer5/sistent"; import { SistentLayout } from "../../sistent-layout"; - import TabButton from "../../../../../reusecore/Button"; import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode"; @@ -33,12 +36,15 @@ const ToggleButtonGuidance = () => { ? "active" : "" } - onClick={() => navigate("/projects/sistent/components/toggle-button")} + onClick={() => + navigate("/projects/sistent/components/toggle-button") + } title="Overview" /> { /> navigate("/projects/sistent/components/toggle-button/code")} + onClick={() => + navigate("/projects/sistent/components/toggle-button/code") + } title="Code" />
- +

Functionality

- The purpose of `ToggleButton` and `ToggleButtonGroup` components is - to streamline user interactions where toggling between states or - selecting options is necessary. Below are some of their most common - applications: + The `ToggleButton` and `ToggleButtonGroup` components provide an + efficient way to handle user interactions for toggling states or + selecting one or multiple options. Below are some common use cases.

-

Single Toggle

+

Exclusive Selection

- A single `ToggleButton` is used to represent a binary choice, such - as enabling or disabling a feature. For example, a toggle button can - be used to switch between "Dark Mode" and "Light Mode" or enable/disable notifications. + Use an exclusive `ToggleButtonGroup` when only one selection is + allowed at a time. This is useful for scenarios like aligning text + to the left, center, or right.

- - Dark Mode - - - -

Grouped Toggle Buttons (Single Selection)

-

- Use a `ToggleButtonGroup` to group multiple related options when only one - selection is allowed at a time. For instance, allowing a user to select a view type, - such as "Grid View" or "List View." -

- - - - Grid View - List View + + Left + Center + Right -

Grouped Toggle Buttons (Multiple Selection)

+ +

Multiple Selection

- Enable multi-selection by using the `allowMultiple` prop in a `ToggleButtonGroup`. - This is particularly useful for scenarios where users need to select multiple - options simultaneously, such as filtering categories or choosing multiple features to enable. + Enable multiple selections within a `ToggleButtonGroup` for cases + where users need to toggle multiple options, such as enabling bold, + italic, and underline text styling simultaneously.

- - Feature 1 - Feature 2 - Feature 3 + + Bold + Italic + Underline - -

Styling Guidelines

-
-

Colors

+

Sizes

- Always use the pre-defined theme styles for colors, such as `primary` or `secondary`. - This ensures consistency across the application and makes it easy to switch between - light and dark themes without additional effort. + Adjust the size of the `ToggleButton` using the `size` prop. This + property supports `small`, `medium`, and `large` values to suit + various design requirements.

-

Size

+
+
+ + + Small + Small + + + Medium + Medium + + + Large + Large + + +
+
+ +

Colors

- The size of the `ToggleButton` can be adjusted using the `size` prop to fit - different screen sizes and contexts. Use `small`, `medium`, or `large` as - values for this property. + Use the `color` prop to style the `ToggleButtonGroup` with + pre-defined theme colors, such as `primary` or `secondary`. This + ensures consistency across the application.

- - Small - - - Medium - - - Large - + + Primary + Secondary + -

Icon Integration

+ +

Vertical Orientation

- Toggle buttons can include icons to make their purpose clearer. Icons - should complement the label text and not replace it entirely. For example, - a grid icon can visually reinforce the "Grid View" label in a toggle button. + The `orientation` prop allows you to arrange toggle buttons + vertically instead of horizontally. This is ideal for menus or + options requiring more vertical space.

- }> - Grid View - + + Vertical 1 + Vertical 2 + Vertical 3 +
diff --git a/src/sections/Projects/Sistent/components/toggle-button/index.js b/src/sections/Projects/Sistent/components/toggle-button/index.js index 94488daf1c0a7..c8670520a0471 100644 --- a/src/sections/Projects/Sistent/components/toggle-button/index.js +++ b/src/sections/Projects/Sistent/components/toggle-button/index.js @@ -29,10 +29,10 @@ const SistentToggleButton = () => { }; return ( - +
-

Toggle Button

+

ToggleButton

The `ToggleButton` and `ToggleButtonGroup` are versatile components