diff --git a/src/pages/projects/sistent/components/box/code.js b/src/pages/projects/sistent/components/box/code.js new file mode 100644 index 000000000000..f7228ded370a --- /dev/null +++ b/src/pages/projects/sistent/components/box/code.js @@ -0,0 +1,8 @@ +import React from "react"; +import { BoxCode } from "../../../../../sections/Projects/Sistent/components/box/code"; + +const BoxCodePage = () => { + return ; +}; + +export default BoxCodePage; diff --git a/src/pages/projects/sistent/components/box/guidance.js b/src/pages/projects/sistent/components/box/guidance.js new file mode 100644 index 000000000000..7294f7552040 --- /dev/null +++ b/src/pages/projects/sistent/components/box/guidance.js @@ -0,0 +1,8 @@ +import React from "react"; +import { BoxGuidance } from "../../../../../sections/Projects/Sistent/components/box/guidance"; + +const BoxGuidancePage = () => { + return ; +}; + +export default BoxGuidancePage; diff --git a/src/pages/projects/sistent/components/box/index.js b/src/pages/projects/sistent/components/box/index.js new file mode 100644 index 000000000000..31eb7536a5e2 --- /dev/null +++ b/src/pages/projects/sistent/components/box/index.js @@ -0,0 +1,8 @@ +import React from "react"; +import SistentBox from "../../../../../sections/Projects/Sistent/components/box/index"; + +const SistentBoxPage = () => { + return ; +}; + +export default SistentBoxPage; diff --git a/src/sections/Projects/Sistent/components/box/code.js b/src/sections/Projects/Sistent/components/box/code.js new file mode 100644 index 000000000000..e2ef20c0ed79 --- /dev/null +++ b/src/sections/Projects/Sistent/components/box/code.js @@ -0,0 +1,208 @@ +import React from "react"; +import { navigate } from "gatsby"; +import { useLocation } from "@reach/router"; + +import { SistentThemeProvider, Box } from "@layer5/sistent"; +import { CodeBlock } from "../button/code-block"; +import { SistentLayout } from "../../sistent-layout"; + +import TabButton from "../../../../../reusecore/Button"; +import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode"; + +const codes = [ + ` +

+ This is a Box component with custom background and padding. +

+
`, + ` +

+ This Box is responsive, changing style based on screen size. +

+
`, + ` +

+ This Box is responsive, changing style based on screen size. +

+
`, + ` +

Hover over this Box to see the interactive effect.

+
`, +]; + +export const BoxCode = () => { + const location = useLocation(); + const { isDark } = useStyledDarkMode(); + + return ( + +
+ +

Box

+
+
+ navigate("/projects/sistent/components/box")} + title="Overview" + /> + + navigate("/projects/sistent/components/box/guidance") + } + title="Guidance" + /> + navigate("/projects/sistent/components/box/code")} + title="Code" + /> +
+
+

+ The Box component is a flexible and foundational + container in Sistent, designed to structure and style content. It + provides quick access to the theme and CSS utilities, allowing for + easy customization and responsive design. Using the sx prop, + developers can apply CSS styles directly with theme-aware + properties, making Box ideal for layouts, spacing, and other UI + adjustments. It can render as any HTML element using the component + prop, offering high versatility in both structure and styling. +

+ +

Basic Box Example

+
+

+ A simple Box component can be used to contain and structure other + elements. Here, the Box serves as a basic container without any + styling applied. +

+
+
+ + +

This is a basic Box component.

+
+
+
+ +
+ +

Styled Box Example

+
+

+ You can add custom styles to a Box component by applying{" "} + sx + properties. In this example, the Box has a background color, + padding, and a defined height. +

+
+
+ + +

+ This is a Box component with custom background and padding. +

+
+
+
+ +
+ +

Responsive Box Example

+
+

+ The Box component also supports responsive styling using the{" "} + sx prop. In this example, the Box adjusts its padding + and background color based on screen size. +

+
+
+ + +

+ This Box is responsive, changing style based on screen size. +

+
+
+
+ +
+ +

Interactive Box Example

+
+

+ Here’s an example where the Box component includes hover effects to + create a more interactive experience. This is useful for buttons, + cards, and other clickable elements. +

+
+
+ + +

+ Hover over this Box to see the interactive effect. +

+
+
+
+ +
+
+
+
+ ); +}; diff --git a/src/sections/Projects/Sistent/components/box/guidance.js b/src/sections/Projects/Sistent/components/box/guidance.js new file mode 100644 index 000000000000..9edf1052df65 --- /dev/null +++ b/src/sections/Projects/Sistent/components/box/guidance.js @@ -0,0 +1,179 @@ +import React from "react"; +import { navigate } from "gatsby"; +import { useLocation } from "@reach/router"; +import { Row } from "../../../../../reusecore/Layout"; +import { SistentThemeProvider, Box } from "@layer5/sistent"; +import { SistentLayout } from "../../sistent-layout"; + +import TabButton from "../../../../../reusecore/Button"; +import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode"; + +export const BoxGuidance = () => { + const location = useLocation(); + const { isDark } = useStyledDarkMode(); + + return ( + +
+ +

Box

+
+

+ The Box component is a flexible, theme-aware container that adapts + seamlessly across various layouts. It provides a convenient way to + apply styles, positioning, and responsive adjustments to content, + making it ideal for any layout needs. +

+
+ navigate("/projects/sistent/components/box")} + title="Overview" + /> + + navigate("/projects/sistent/components/box/guidance") + } + title="Guidance" + /> + navigate("/projects/sistent/components/box/code")} + title="Code" + /> +
+ +
+

+ The Box component is a highly versatile tool that can be used for + layout management, spacing, styling, and more. With full support for + responsive design, Box is an essential part of any well-structured + application, allowing developers to customize and style elements + while keeping the theme consistent. +

+ + +

Function

+
+ +

The Box component serves several functions:

+ +

Responsive Styling

+

+ The sx prop makes it easy to apply responsive styles + directly within the component, allowing for adaptive design that + looks great across all screen sizes. +

+ + + +

+ This is a responsive Box component. +

+
+
+
+ +

Flexible Layout Control

+

+ Box can serve as a container for organizing other elements, whether + it's aligning text, images, or interactive components. The + flexibility of the Box component allows it to adapt to a wide range + of layout needs, from card-style containers to more complex nested + structures. +

+ +

Customizable Appearance

+

+ The Box component’s customization options allow you to adjust + colors, borders, shadows, and more through the sx prop, + ensuring that components blend well with your app's overall theme. +

+ + + +

+ Customized Box with shadow and color. +

+
+
+
+ + +

Use Cases

+
+ +

Nested Layouts

+

+ Use Box to create nested layouts by embedding one Box within + another, each with distinct styling. This setup enables the creation + of structured and multi-layered designs. +

+ + + + +

Nested Box layout example.

+
+
+
+
+ +

Utility for Spacing and Margin

+

+ Leveraging Box for margin and padding adjustments offers + fine-grained control over spacing between components, making it + useful in complex layouts where alignment and spacing are crucial. +

+ +

Event Handling and State Management

+

+ Box can also be used as an interactive element, handling events and + managing state. This makes it ideal for use cases that require + dynamic behavior or user interaction. +

+ +

Responsive Design

+

+ The Box component seamlessly integrates with Sistent’s responsive + design principles, providing a cohesive experience across various + screen sizes by leveraging breakpoints in the sx prop. +

+
+
+
+ ); +}; diff --git a/src/sections/Projects/Sistent/components/box/index.js b/src/sections/Projects/Sistent/components/box/index.js new file mode 100644 index 000000000000..bb02738c6122 --- /dev/null +++ b/src/sections/Projects/Sistent/components/box/index.js @@ -0,0 +1,133 @@ +import React from "react"; +import { navigate } from "gatsby"; +import { useLocation } from "@reach/router"; + +import { SistentThemeProvider, Box } from "@layer5/sistent"; +import TabButton from "../../../../../reusecore/Button"; +import { SistentLayout } from "../../sistent-layout"; +import { Row } from "../../../../../reusecore/Layout"; +import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode"; + +const SistentBox = () => { + const location = useLocation(); + const { isDark } = useStyledDarkMode(); + + return ( + +
+ +

Box

+
+

+ The Box component is a versatile, theme-aware container + in Sistent, ideal for styling and layout customization. It supports + the sx prop for easy, responsive styling and can render as any HTML + element. +

+
+ navigate("/projects/sistent/components/box")} + title="Overview" + /> + + navigate("/projects/sistent/components/box/guidance") + } + title="Guidance" + /> + navigate("/projects/sistent/components/box/code")} + title="Code" + /> +
+
+

+ The Box component is a flexible and foundational + container in Sistent, designed to structure and style content. It + provides quick access to the theme and CSS utilities, allowing for + easy customization and responsive design. Using the sx prop, + developers can apply CSS styles directly with theme-aware + properties, making Box ideal for layouts, spacing, and other UI + adjustments. It can render as any HTML element using the component + prop, offering high versatility in both structure and styling. +

+ +

Usage

+
+

+ The Box component differs from other containers available in Sistent + in that its usage is intended to be multipurpose and open-ended, + just like a `div`. Components like Container, Stack and + Paper, by contrast, feature usage-specific props that make them + ideal for certain use cases: Container for main layout orientation, + Stack for one-dimensional layouts, and Paper for elevated surfaces. +

+

Box component

+

+ The Box component renders as a `div` by default, but + you can swap in any other valid HTML tag or React component using + the component prop. The demo below replaces the `div` + with a `section` element: +

+ + + + This Box renders as an HTML section element. + + + + + +

Customization

+
+

+ The Box component can be styled flexibly with Sistent + sxprop and custom themes. The sx prop allows quick + application of CSS styles that are theme-aware, enabling responsive + and consistent design. +

+ +

Using the sx Prop

+

+ The sx prop supports a wide range of style properties, including + colors, spacing, and responsive adjustments. It directly accesses + theme values, allowing you to apply theme-based styles to a Box with + minimal code. +

+ + + + + +
+
+
+ ); +}; + +export default SistentBox; diff --git a/src/sections/Projects/Sistent/components/index.js b/src/sections/Projects/Sistent/components/index.js index 749fb2c5e34e..2c5e401325b8 100644 --- a/src/sections/Projects/Sistent/components/index.js +++ b/src/sections/Projects/Sistent/components/index.js @@ -72,6 +72,13 @@ const componentsData = [ "ButtonGroup is a component that groups multiple buttons together.", url: "/projects/sistent/components/button-group", }, + { + id: 10, + name: "Box", + description: + "Box is used as a flexible container for layout and styling, allowing quick customization and responsive design adjustments.", + url: "/projects/sistent/components/box", + }, ]; const SistentComponents = () => {