-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
730 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/assets/css/src/scss/_components/_setting-block/_elements/_build-option.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@use "sass:map"; | ||
|
||
@use "../../../_utils/utils" as *; | ||
|
||
/// Build body content | ||
/// | ||
/// @type block | ||
/// @author WPMU DEV | ||
/// | ||
/// @param {String} $block - Main block name | ||
@mixin build-option($block) { | ||
// DIR: Left to right. | ||
// THEME: None. | ||
@include sui-class($rtl: false, $theme: null) { | ||
// Block wrapper. | ||
@include block($block) { | ||
@include element(option-title) { | ||
font-size: $font-size-default; | ||
font-weight: $font-weight-md; | ||
margin: 0 0 $spacing-sm 0; | ||
} | ||
|
||
@include element(option-description) { | ||
font-size: $font-size-default; | ||
margin: 0 0 $spacing-md 0; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
@forward "./build-info"; | ||
@forward "./build-body"; | ||
@forward "./build-header"; | ||
@forward "./build-option"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/ui/setting-block/src/elements/setting-block-option.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from "react" | ||
|
||
import { _renderHTMLPropsSafely, generateCN } from "@wpmudev/sui-utils" | ||
import { useStyles } from "@wpmudev/sui-hooks" | ||
|
||
import { SettingBlockOptionProps } from "../setting-block.types" | ||
|
||
export const SettingBlockOption: React.FC<SettingBlockOptionProps> = ({ | ||
title, | ||
description, | ||
className, | ||
children, | ||
actions, | ||
_htmlProps, | ||
_style = {}, | ||
}) => { | ||
const { suiInlineClassname } = useStyles(_style, className) | ||
|
||
// Define class name based on various conditions | ||
const classNames = generateCN( | ||
"sui-setting-block__option", | ||
{}, | ||
suiInlineClassname, | ||
) | ||
|
||
return ( | ||
<div className={classNames}> | ||
<div className="sui-setting-block__option-header"> | ||
{!!title && ( | ||
<h6 className="sui-setting-block__option-title">{title}</h6> | ||
)} | ||
{!!description && ( | ||
<p className="sui-setting-block__option-description">{description}</p> | ||
)} | ||
</div> | ||
{!!children && ( | ||
<div className="sui-setting-block__option-body">{children}</div> | ||
)} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
// export components | ||
export { SettingBlock } from "./setting-block" | ||
|
||
export { SettingBlockOption } from "./elements/setting-block-option" | ||
|
||
// export types | ||
export type { SettingBlockProps } from "./setting-block.types" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions
42
packages/ui/setting-block/stories/images/layout-variation.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions
60
packages/ui/setting-block/stories/images/setting-block-body.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions
48
packages/ui/setting-block/stories/images/setting-block-option.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
130 changes: 130 additions & 0 deletions
130
packages/ui/setting-block/stories/images/spacing-block-body.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
138 changes: 138 additions & 0 deletions
138
packages/ui/setting-block/stories/images/spacing-main-wrap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,100 @@ | ||
import { Section, Row, Col } from "@wpmudev/sui-docs" | ||
import { Section, Row, Col, List } from "@wpmudev/sui-docs" | ||
|
||
import Anatomy from "../images/anatomy.svg" | ||
import Spacings from "../images/spacings.svg" | ||
import SpacingMainWrap from "../images/spacing-main-wrap.svg" | ||
import SpacingBlockBody from "../images/spacing-block-body.svg" | ||
import SettingBlockBody from "../images/setting-block-body.svg" | ||
import SettingBlockOption from "../images/setting-block-option.svg" | ||
import LayoutVariation from "../images/layout-variation.svg" | ||
import HeaderWidth from "../images/header-width.svg" | ||
import Types from "../images/types.svg" | ||
import Examples from "../images/examples.svg" | ||
|
||
<Section title="Anatomy" style={{ paddingTop: 20 }}> | ||
<img src={Anatomy} alt="Setting Block Anatomy" style={{ marginBottom: 20 }} /> | ||
<h3>1. Block title</h3> | ||
<h3>1. Setting block header</h3> | ||
<p> | ||
The left column is for setting block the title and description. It gives a | ||
glance of the setting block to users. | ||
The setting block header includes a title and a brief description to summarize its purpose. | ||
</p> | ||
|
||
<h3>2. Block Option</h3> | ||
<p> | ||
Box body is a flexible area where the main content can be inserted. It may include list, table or any type of content that is available for settings. | ||
</p> | ||
<h3>2. Setting block body</h3> | ||
<p> | ||
The setting block body is designed to display setting options. It accommodates multiple options within a single settings block, providing a structured area to organize and present them clearly. | ||
</p> | ||
</Section> | ||
|
||
<Section title="Setting block body" style={{ paddingTop: 20 }}> | ||
<p>The setting block body is designed to display setting options. It accommodates multiple options within a single settings block, providing a structured area to organize and present them clearly.</p> | ||
<img | ||
src={SettingBlockBody} | ||
alt="Setting Block Body" | ||
style={{ marginBottom: 20 }} | ||
/> | ||
</Section> | ||
|
||
<Section title="Spacings" style={{ paddingTop: 20 }}> | ||
<Section title="Setting block option" style={{ paddingTop: 20 }}> | ||
<p>The Setting Block Option is a component designed to display individual setting options. It is divided into two sections: Setting block option header and Setting block option body</p> | ||
<img | ||
src={SettingBlockOption} | ||
alt="Setting Block Option" | ||
style={{ marginBottom: 20 }} | ||
/> | ||
|
||
<p> | ||
<strong>1. Setting block option header</strong> | ||
<List> | ||
<span label="Includes a title and an optional description to provide context or details about the setting." /> | ||
<span label="It is a boolean property, making it optional and configurable based on design needs." /> | ||
</List> | ||
</p> | ||
|
||
<p> | ||
<strong>2. Setting block option body</strong> | ||
<List> | ||
<span label="This is the main area where setting components or elements are displayed." /> | ||
<span label="This section supports full customization and layout flexibility, including the use of utilities such as margins, borders, columns, and more." /> | ||
</List> | ||
</p> | ||
</Section> | ||
|
||
<Section title="Layout variation" style={{ paddingTop: 20 }}> | ||
<img | ||
src={Spacings} | ||
alt="Setting Block Anatomy" | ||
src={LayoutVariation} | ||
alt="Layout variation" | ||
style={{ marginBottom: 20 }} | ||
/> | ||
</Section> | ||
|
||
<Section title="Types" style={{ paddingTop: 20 }}> | ||
<img src={Types} alt="Setting Block Types" style={{ marginBottom: 20 }} /> | ||
<img | ||
src={Types} | ||
alt="Types" | ||
style={{ marginBottom: 20 }} | ||
/> | ||
</Section> | ||
|
||
<Section title="Setting block header width for default layout" style={{ paddingTop: 20 }}> | ||
<p>The Setting Block Header is designed to occupy 30% of the available width to ensure responsive content management. However, to prevent the header from shrinking excessively, a minimum width of 240px is enforced. This ensures readability and maintains a consistent layout across various screen sizes.</p> | ||
<img | ||
src={HeaderWidth} | ||
alt="Header Width" | ||
style={{ marginBottom: 20 }} | ||
/> | ||
</Section> | ||
|
||
<Section title="Examples" style={{ paddingTop: 20 }}> | ||
<Section title="Spacings" style={{ paddingTop: 20 }}> | ||
<h3>Setting block main wrap</h3> | ||
<img | ||
src={SpacingMainWrap} | ||
alt="Spacing Wrap" | ||
style={{ marginBottom: 20 }} | ||
/> | ||
|
||
<h3>Setting block body</h3> | ||
<img | ||
src={Examples} | ||
alt="Setting Block Examples" | ||
src={SpacingBlockBody} | ||
alt="Spacing Block Body" | ||
style={{ marginBottom: 20 }} | ||
/> | ||
</Section> | ||
|