From f8cbea196f7372b316393fa7519d31899e8fba6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Parrino?= Date: Fri, 31 May 2024 10:01:06 -0300 Subject: [PATCH] Update design-system (add DIG components) (#1997) * Update design-system.md * add interactive examples --- .../near-components/design-system.md | 649 +++++++++++++++++- .../src/components/widget-editor-mainnet.js | 65 ++ 2 files changed, 709 insertions(+), 5 deletions(-) create mode 100644 website/src/components/widget-editor-mainnet.js diff --git a/docs/3.tutorials/near-components/design-system.md b/docs/3.tutorials/near-components/design-system.md index f94e28a4106..0ae7f8501de 100644 --- a/docs/3.tutorials/near-components/design-system.md +++ b/docs/3.tutorials/near-components/design-system.md @@ -2,6 +2,7 @@ id: ds-components title: Design Components --- +import {WidgetEditor} from "@site/src/components/widget-editor-mainnet"; # Design System Components @@ -135,26 +136,664 @@ return ( ); ``` +## UI is Near + +[UI is Near](https://www.uiisnear.xyz/) is community-built library offering a comprehensive collection of UI components providing a solid foundation for creating intuitive and visually appealing user interfaces for dApps, wallets or other Web3 solutions. + +:::tip + +You can find the documentation, available components, and code examples following this [this link](https://www.uiisnear.xyz/). + +::: + ## DIG components -These are the Design Interface Guidelines (DIG) components available on the NEAR VM: +These are the Decentralized Interface Guidelines (DIG) components available on the NEAR VM: + +- [DIG.Accordion](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Accordion) +- [DIG.Avatar](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Avatar) +- [DIG.Badge](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Badge) +- [DIG.Button](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Button) +- [DIG.Checkbox](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Checkbox) +- [DIG.Chip](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Chip) +- [DIG.Dialog](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Dialog) +- [DIG.DropdownMenu](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.DropdownMenu) +- [DIG.Input](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Input) +- [DIG.InputSearch](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.InputSearch) +- [DIG.InputSelect](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.InputSelect) +- [DIG.InputTags](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.InputTags) +- [DIG.InputTextarea](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.InputTextarea) +- [DIG.Tabs](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Tabs) +- [DIG.Theme](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Theme) +- [DIG.Toast](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Toast) +- [DIG.Tooltip](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Tooltip) + + +:::tip + +If you want to see working demos of these components, check the [DIG Overview page](https://dev.near.org/near/widget/DIG.OverviewPage). + +::: + +--- + +### `DIG.Accordion` + +An accordion built with the [Radix primitive](https://www.radix-ui.com/docs/primitives/components/accordion). + + + +```jsx +// Rendering the component with props +return ( +

My JSX context 1.

+

Here's another paragraph.

+ + ), + }, + { + value: "2", + header: "Header 2", + content: ( + <> +

My JSX context 2.

+

Here's another paragraph.

+ + ), + }, + ], + }} +/>); +``` + +
+ +:::info DIG.Accordion properties -- [DIG.Button](https://near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Button) -- [DIG.Theme](https://near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Theme) +[Click here](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Accordion&tab=about) for properties and details. + +::: + +--- + +### `DIG.Avatar` + +This component renders an avatar. + + + +```jsx +const accountId = "root.near"; +const profile = props.profile || Social.get(`${accountId}/profile/**`, "final"); + +// Rendering the component with props +return ( + +); +``` + + + + +:::info DIG.Avatar properties + +[Click here](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Avatar&tab=about) for properties and details. + +::: + +--- + +### `DIG.Badge` + +This component renders a badge. Badges are not meant to be clickable. Refer to [DIG.Button](#digbutton) or [DIG.Chip](#digchip) for clickable alternatives. + + + +```jsx +// Rendering the component with props +return ( + +); +``` + + + +:::info DIG.Badge properties + +[Click here](https://dev.near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Badge&tab=about) for properties and details. + +::: + +--- ### `DIG.Button` A fully featured button component that can act as a `