diff --git a/src/sections/Projects/Sistent/components/content.js b/src/sections/Projects/Sistent/components/content.js index 388e34486f06..8e88c73a4805 100644 --- a/src/sections/Projects/Sistent/components/content.js +++ b/src/sections/Projects/Sistent/components/content.js @@ -3,7 +3,7 @@ const componentsData = [ id: 1, name: "Button", description: - "A button is an interactive element that triggers a specific action and also lets users know what will happen next.", + "A button is an interactive element that triggers a specific action and also lets users know what will happen next.", url: "/projects/sistent/components/button", src: "/button", }, @@ -11,7 +11,7 @@ const componentsData = [ id: 2, name: "Text Input", description: - "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.", + "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/text-input", src: "/text-input", }, @@ -19,7 +19,7 @@ const componentsData = [ id: 3, name: "Modal", description: - "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.", + "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", }, @@ -27,7 +27,7 @@ const componentsData = [ id: 4, name: "Paper", description: - "The Paper component offers an elevated surface with shadow effects, following Material Design’s elevation system.", + "The Paper component offers an elevated surface with shadow effects, following Material Design’s elevation system.", url: "/projects/sistent/components/paper", src: "/paper", }, @@ -35,7 +35,7 @@ const componentsData = [ id: 5, name: "Popper", description: - "A popper is a tooltip that appears when a user interacts with an element.", + "A popper is a tooltip that appears when a user interacts with an element.", url: "/projects/sistent/components/popper", src: "/popper", }, @@ -43,7 +43,7 @@ const componentsData = [ id: 6, name: "Text Field", description: - "The TextField component is a versatile input field used to capture user input in forms and user interfaces.", + "The TextField component is a versatile input field used to capture user input in forms and user interfaces.", url: "/projects/sistent/components/text-field", src: "/text-field", }, @@ -51,7 +51,7 @@ const componentsData = [ id: 7, name: "Link", description: - "Links are essential and integral components of an interface. They are primarily used for navigation, guiding users to the next step in a journey or redirecting them to relevant sections or pages.", + "Links are essential and integral components of an interface. They are primarily used for navigation, guiding users to the next step in a journey or redirecting them to relevant sections or pages.", url: "/projects/sistent/components/link", src: "/link", }, @@ -59,7 +59,7 @@ const componentsData = [ id: 8, name: "Container", description: - "Containers align and center content, providing responsive layout options for different screen sizes.", + "Containers align and center content, providing responsive layout options for different screen sizes.", url: "/projects/sistent/components/container", src: "/container", }, @@ -67,7 +67,7 @@ const componentsData = [ id: 9, name: "ButtonGroup", description: - "ButtonGroup is a component that groups multiple buttons together.", + "ButtonGroup is a component that groups multiple buttons together.", url: "/projects/sistent/components/button-group", src: "/button-group", }, @@ -75,7 +75,7 @@ const componentsData = [ id: 10, name: "Box", description: - "Box is used as a flexible container for layout and styling, allowing quick customization and responsive design adjustments.", + "Box is used as a flexible container for layout and styling, allowing quick customization and responsive design adjustments.", url: "/projects/sistent/components/box", src: "/box", }, @@ -83,7 +83,7 @@ const componentsData = [ id: 11, name: "Tooltip", description: - "The Tooltip component is a small pop-up box that appears when a user hovers over an element.", + "The Tooltip component is a small pop-up box that appears when a user hovers over an element.", url: "/projects/sistent/components/tooltip", src: "/tooltip", }, @@ -91,10 +91,17 @@ const componentsData = [ id: 12, name: "Backdrop", description: - "Backdrop component overlays a dimmed screen to focus attention on foreground content.", + "Backdrop component overlays a dimmed screen to focus attention on foreground content.", url: "/projects/sistent/components/backdrop", src: "/backdrop", }, + { + id: 13, + name: "Select", + description: "Select desc", + url: "/projects/sistent/components/select", + src: "/select", + }, ]; -module.exports = { componentsData }; \ No newline at end of file +module.exports = { componentsData }; diff --git a/src/sections/Projects/Sistent/components/select/code-block.js b/src/sections/Projects/Sistent/components/select/code-block.js new file mode 100644 index 000000000000..2a7463d6ceec --- /dev/null +++ b/src/sections/Projects/Sistent/components/select/code-block.js @@ -0,0 +1,20 @@ +import React, { useState } from "react"; +import Code from "../../../../../components/CodeBlock"; + +export const CodeBlock = ({ name, code }) => { + const [showCode, setShowCode] = useState(false); + const onChange = () => { + setShowCode((prev) => !prev); + }; + return ( +
+ + + {showCode && ( + + )} +
+ ); +}; diff --git a/src/sections/Projects/Sistent/components/select/code.js b/src/sections/Projects/Sistent/components/select/code.js new file mode 100644 index 000000000000..d3f56216d7e4 --- /dev/null +++ b/src/sections/Projects/Sistent/components/select/code.js @@ -0,0 +1,477 @@ +import React from "react"; + +import { SistentThemeProvider } from "@layer5/sistent"; +import { CodeBlock } from "./code-block"; +import { SistentLayout } from "../../sistent-layout"; + +import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode"; +import SectionNav from "./section-nav"; +import Header from "./header"; +import { + FormControl, + FormHelperText, + InputLabel, + ListSubheader, + MenuItem, + OutlinedInput, + Select, +} from "@mui/material"; + +const codes = { + "variant-outlined": ` + +`, + + "variant-filled": ` + +`, + + "variant-standard": ` + +`, + + "size-auto": ` + +`, + + "size-small": ` + +`, + + "size-fullwidth": ` + +`, + + "behavior-error-disabled": ` + + +`, + + "behavior-required": ` + + Age + + +`, + + "customize-label": ` + + Age + + +`, + "customize-helper-text": ` + + + This is a helper text + +`, + + "customize-placeholder": `const [selectedAge, setSelectedAge] = React.useState(""); + + + +`, + + "customize-grouping": ``, + + multiselect: `const [multipleAges, setMultipleAges] = React.useState([]); +const handleMultiplSelect = (event) => { + let agesList = event.target.value; + setMultipleAges(agesList); +}; + + +`, +}; + +const SelectCode = () => { + const { isDark } = useStyledDarkMode(); + const [selectedAge, setSelectedAge] = React.useState(""); + const [multipleAges, setMultipleAges] = React.useState([10]); + const handleMultiplSelect = (event) => { + let agesList = event.target.value; + setMultipleAges(agesList); + }; + return ( + +
+
+ + +
+ +

Select variants

+
+

+ The select comes in three types: Outlined, Filled, and Standard. To + specify the variant, pass a value to the variant prop. +

+

Outlined

+

+ If not specified, the default variant of the select if outlined. +

+
+
+ + + +
+ +
+

Filled

+
+
+ + + +
+ +
+

Standard

+
+
+ + + +
+ +
+ +

Sizes

+
+

+ There are 3 size option for the select component: autowidth, small, + and fullWidth. Depending on the size of the select, different prop + can be passed to the component. +

+

Autowidth

+

+ An autoWidth option is passed to the component to enable this + attribute +

+
+
+ + + +
+ +
+

Small

+

+ To generate small select, pass a size prop with a value of small +

+
+
+ + + +
+ +
+

Full width

+

+ The select will expand the full width of its parent when passed + fullWidth prop +

+
+
+ + + +
+ +
+ +

Customization

+
+

Label

+

+ To add a label to the select component, wrap it inside a FormControl + component. Add an InputLabel component and link it to the select + component using the labelId prop. Ensure the label prop in the + Select component matches the InputLabel text. +

+
+
+ + + Age + + + +
+ +
+

Helper text

+
+
+ + + + This is a helper text + + +
+ +
+

Placeholder

+

+ To add a placeholder, use the renderValue prop to display a + placeholder text when no value is selected. +

+
+
+ + + +
+ +
+

Grouping

+ To group selection options, use the ListSubheader component to create + headers for each group within the dropdown menu. This helps users to + easily navigate and find the options they need. +
+
+ + + +
+ +
+

+ Additional props such as error, required, and disabled can be passed + to the select component to customize its behavior. +

+
+
+ + + + +
+ +
+
+
+ + + Age + + + +
+ +

+ NOTE: +

+

+ When the select component is marked as required, an asterisk is + added to the label to indicate this to the user. It is recommended + to use this feature in conjunction with the label for better + clarity. +

+
+ +

Multi-select

+
+
+
+ + + +
+ +
+
+
+
+ ); +}; + +export default SelectCode; diff --git a/src/sections/Projects/Sistent/components/select/guidance.js b/src/sections/Projects/Sistent/components/select/guidance.js new file mode 100644 index 000000000000..ab5062fb3cfd --- /dev/null +++ b/src/sections/Projects/Sistent/components/select/guidance.js @@ -0,0 +1,245 @@ +import React from "react"; +import { Row } from "../../../../../reusecore/Layout"; +import { SistentThemeProvider } from "@layer5/sistent"; +import { SistentLayout } from "../../sistent-layout"; +import { + FormHelperText, + FormControl, + InputLabel, + Select, + MenuItem, + Grid, + ListSubheader, + OutlinedInput, +} from "@mui/material"; +import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode"; +import SectionNav from "./section-nav"; +import Header from "./header"; +const SelectGuidance = () => { + const { isDark } = useStyledDarkMode(); + const [selectedAge, setSelectedAge] = React.useState(""); + const [multipleAges, setMultipleAges] = React.useState([]); + const handleMultiplSelect = (event) => { + let agesList = event.target.value; + setMultipleAges(agesList); + }; + return ( + +
+
+ +
+ +

Functions

+
+

+ The select component can exhibit different state based on the + context and user input. Since it is usually used within a form + component, these states can act in response to the user input for + other components in the form. +

+

Disabled

+

+ If the component is disabled, the dropdown menu won't display when + user clicks on the selection area. This behavior is useful when the + user is not allowed to select any option. +

+ + + + Age + + + + +

Error

+

+ This behavior is used to indicate that the user has made an error or + the selection is not compatible with other form components. +

+ + + + Age + + + + +

Required

+

+ If specified, the select component will be required to have an input + from the user. An asterisk will be displayed next to the label to + let the user know that the input is required. +

+ + + + Age + + + + + +

Customization

+
+

+ Additional props can be added to the select component to customize + its label and dropdown menu to provide use with more context of + their selection. +

+

Label and helper text

+

+ The label is optional. If provided, helper text is displayed below + the component to give the user more context about the component. +

+ + + + + Age + + With label + Helper text + + + + Without label + + + +

Placeholder

+

+ A placeholder is a short hint or description that is displayed + inside an input field or select component before the user enters a + value. It provides a clue to the user about what kind of information + is expected in the field. The placeholder text disappears when the + user starts typing or selects an option. +

+ + + + + + + +

Grouping

+

+ If the selection options are organized into groups, their groups can + be displayed within the dropdown menu to assist users in making + their selection. +

+ + + + Age + + + + + +

Multiple select

+
+

+ The multiple select component allows users to select more than one + option from the dropdown list. This is useful in scenarios where + multiple selections are required, such as selecting multiple tags, + categories, or items. +

+ + + + Age + + + + +
+
+
+ ); +}; + +export default SelectGuidance; diff --git a/src/sections/Projects/Sistent/components/select/header.js b/src/sections/Projects/Sistent/components/select/header.js new file mode 100644 index 000000000000..84f3f0008946 --- /dev/null +++ b/src/sections/Projects/Sistent/components/select/header.js @@ -0,0 +1,13 @@ +import React from "react"; +export default function Header() { + return ( + <> + +

Select

+
+

+ Select component is a dropdown menu for selecting an option from a list. +

+ + ); +} diff --git a/src/sections/Projects/Sistent/components/select/index.js b/src/sections/Projects/Sistent/components/select/index.js new file mode 100644 index 000000000000..68c13842d2a3 --- /dev/null +++ b/src/sections/Projects/Sistent/components/select/index.js @@ -0,0 +1,226 @@ +import React from "react"; +import { SistentThemeProvider } from "@layer5/sistent"; +import { SistentLayout } from "../../sistent-layout"; +import { Row } from "../../../../../reusecore/Layout"; +import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode"; +import { + FormControl, + InputLabel, + MenuItem, + Select, + OutlinedInput, +} from "@mui/material"; +import Header from "./header"; +import SectionNav from "./section-nav"; + +const SistentSelect = () => { + const { isDark } = useStyledDarkMode(); + const [multipleAges, setMultipleAges] = React.useState([]); + const handleMultiplSelect = (event) => { + let agesList = event.target.value; + setMultipleAges(agesList); + }; + + return ( + +
+
+ +
+

+ The Select component is a versatile and customizable element + commonly used in forms and user interfaces. It is designed to + present a list of options for users to choose from, either as a + single selection or multiple selections. This component plays a + vital role in collecting user-provided information efficiently and + intuitively. +

+ +

Types

+
+

+ To accommodate various design styles and use cases, the select + component offers numerous customizable properties. Developers can + customize how the component display the labels or selected option to + improve user experience. +

+

Outlined

+

+ The default style is "outlined," featuring a thin line around the + selection area. The label appears above the selection, and the + dropdown menu is displayed below it. +

+ + + + Age + + + + +

Filled

+

+ Filled select feature a background color fill. Depending on the + theme or intended action, the color fill ican range from a primary + brand color to any other applicable color in a brand's color + palette. +

+ + + + Age + + + + +

Standard

+

+ The standard style features a simple underline below the selection + area. +

+ + + + Age + + + + + +

Sizes

+
+

+ The select component can be adjusted in size to accommodate various + use cases. These size adjustments typically affect the height of the + component, while the width adjusts to fit the content. The height of + the select component is derived from our spacing system to maintain + consistency. We offer multiple sizes to meet different needs. +

+

Auto width

+

+ The width of the component can scale automatically to fit the + content it contains. This ensures that the select component is + appropriately sized based on the options available, providing a + better user experience. +

+ + + + Age + + + + +

Small

+

+ The small size select component is designed to fit into more compact + spaces within a user interface. It is particularly useful when you + need to conserve space or when the select component is part of a + form with other small-sized elements. This ensures a consistent and + visually appealing layout. +

+ + + + Age + + + + +

Full width

+

+ Full width select are more efficient in mobile designs and rightly + so in order to offer users with a wider touch area since the input + devices - the fingers, are a lot larger than the cursor on a desktop + or larger screen. +

+ + + + Age + + + + + +

Multiple select

+
+

Multiple select component allows users to select more than one.

+ + + + Age + + + + +
+
+
+ ); +}; + +export default SistentSelect; diff --git a/src/sections/Projects/Sistent/components/select/section-nav.js b/src/sections/Projects/Sistent/components/select/section-nav.js new file mode 100644 index 000000000000..fa6098591ac8 --- /dev/null +++ b/src/sections/Projects/Sistent/components/select/section-nav.js @@ -0,0 +1,38 @@ +import { navigate } from "gatsby"; +import TabButton from "../../../../../reusecore/Button"; +import React from "react"; +import { useLocation } from "@reach/router"; +export default function SectionNav() { + const location = useLocation(); + return ( +
+ navigate("/projects/sistent/components/select")} + title="Overview" + /> + navigate("/projects/sistent/components/select/guidance")} + title="Guidance" + /> + navigate("/projects/sistent/components/select/code")} + title="Code" + /> +
+ ); +}