From da13a7a25e78f65f9c78cee6f353f5ba8b685578 Mon Sep 17 00:00:00 2001 From: harish-viswa Date: Tue, 11 Feb 2025 18:32:12 +0530 Subject: [PATCH] docs: added few more docs for ui components --- .../src/content/docs/components/no-data.mdx | 126 ++++++++ .../content/docs/components/scroll-area.mdx | 106 +++++++ .../content/docs/components/search-box.mdx | 147 +++++++++ .../src/content/docs/components/select.mdx | 256 ++++++++++++++++ .../src/content/docs/components/sha-badge.mdx | 132 ++++++++ .../src/content/docs/components/spacer.mdx | 51 ++++ .../content/docs/components/stacked-list.mdx | 201 ++++++++++++ .../content/docs/components/styled-link.mdx | 48 +++ .../src/content/docs/components/table.mdx | 289 ++++++++++++++++++ .../src/content/docs/components/tabs.mdx | 237 ++++++++++++++ .../src/content/docs/components/text.mdx | 134 ++++++++ .../src/content/docs/components/textarea.mdx | 122 ++++++++ .../src/content/docs/components/topbar.mdx | 133 ++++++++ .../src/content/docs/soon/stacked-list.mdx | 47 --- 14 files changed, 1982 insertions(+), 47 deletions(-) create mode 100644 apps/portal/src/content/docs/components/no-data.mdx create mode 100644 apps/portal/src/content/docs/components/scroll-area.mdx create mode 100644 apps/portal/src/content/docs/components/search-box.mdx create mode 100644 apps/portal/src/content/docs/components/select.mdx create mode 100644 apps/portal/src/content/docs/components/sha-badge.mdx create mode 100644 apps/portal/src/content/docs/components/spacer.mdx create mode 100644 apps/portal/src/content/docs/components/stacked-list.mdx create mode 100644 apps/portal/src/content/docs/components/styled-link.mdx create mode 100644 apps/portal/src/content/docs/components/table.mdx create mode 100644 apps/portal/src/content/docs/components/tabs.mdx create mode 100644 apps/portal/src/content/docs/components/text.mdx create mode 100644 apps/portal/src/content/docs/components/textarea.mdx create mode 100644 apps/portal/src/content/docs/components/topbar.mdx delete mode 100644 apps/portal/src/content/docs/soon/stacked-list.mdx diff --git a/apps/portal/src/content/docs/components/no-data.mdx b/apps/portal/src/content/docs/components/no-data.mdx new file mode 100644 index 0000000000..7c1c093f6f --- /dev/null +++ b/apps/portal/src/content/docs/components/no-data.mdx @@ -0,0 +1,126 @@ +--- +title: No Data +description: No Data component documentation +--- + +The No Data component provides a UI element for displaying a message when there is no data available. It includes optional features like icons, descriptions, and action buttons. + +import { DocsPage } from "@/components/docs-page"; + + console.log("Primary Action Clicked") }} + secondaryButton={{ label: "Secondary Action", onClick: () => console.log("Secondary Action Clicked") }} + />`} +/> + +## Usage + +```typescript jsx +import { NoData } from '@harnessio/ui/components' + +return ( + console.log("Primary Action Clicked") }} + secondaryButton={{ label: "Secondary Action", onClick: () => console.log("Secondary Action Clicked") }} + /> +) +``` + +## API Reference + + void, to?: string }", + }, + { + name: "secondaryButton", + description: "The secondary action button", + required: false, + value: "{ label: string, onClick?: () => void, to?: string }", + }, + { + name: "withBorder", + description: "Whether to display a border around the no data message", + required: false, + value: "boolean", + defaultValue: "false", + }, + { + name: "loadState", + description: "The current load state", + required: false, + value: "string", + }, + { + name: "setLoadState", + description: "Function to set the load state", + required: false, + value: "Dispatch>", + }, + { + name: "textWrapperClassName", + description: "Additional class names for the text wrapper", + required: false, + value: "string", + }, + { + name: "className", + description: "Additional class names for the no data message", + required: false, + value: "string", + }, + ]} +/> + +### Supported Icon Names + +The `NoData` component supports the following icon names: + +- `no-data-folder` +- `no-search-magnifying-glass` +- `no-data-merge` +- `no-data-cog` +- `no-data-webhooks` +- `no-data-branches` +- `no-data-members` +- `no-repository` +- `no-data-error` +- `no-data-commits` +- `no-data-pr` diff --git a/apps/portal/src/content/docs/components/scroll-area.mdx b/apps/portal/src/content/docs/components/scroll-area.mdx new file mode 100644 index 0000000000..24935445ee --- /dev/null +++ b/apps/portal/src/content/docs/components/scroll-area.mdx @@ -0,0 +1,106 @@ +--- +title: Scroll Area +description: Scroll Area component documentation +--- + +The Scroll Area component provides a UI element for creating scrollable areas with custom scrollbars. It includes various customization options. + +import { DocsPage } from "@/components/docs-page"; + + +
+

Scrollable content goes here.

+

Scrollable content goes here.

+

Scrollable content goes here.

+

Scrollable content goes here.

+

Scrollable content goes here.

+
+`} +/> + +## Usage + +```typescript jsx +import { ScrollArea } from '@harnessio/ui/components' + +return ( + +
+

Scrollable content goes here.

+

Scrollable content goes here.

+

Scrollable content goes here.

+

Scrollable content goes here.

+

Scrollable content goes here.

+
+
+) +``` + +## Anatomy + +The Scroll Area component can be used to create scrollable areas with custom scrollbars. + +```typescript jsx + +
+

Scrollable content goes here.

+

Scrollable content goes here.

+

Scrollable content goes here.

+

Scrollable content goes here.

+

Scrollable content goes here.

+
+
+``` + +## API Reference + +### ScrollArea + +The `ScrollArea` component serves as the main container for the scrollable area. + + + +### ScrollBar + +The `ScrollBar` component is used to display a custom scrollbar inside the scroll area. + + diff --git a/apps/portal/src/content/docs/components/search-box.mdx b/apps/portal/src/content/docs/components/search-box.mdx new file mode 100644 index 0000000000..67768d8a6c --- /dev/null +++ b/apps/portal/src/content/docs/components/search-box.mdx @@ -0,0 +1,147 @@ +--- +title: Search Box +description: Search Box component documentation +--- + +The Search Box component provides a UI element for entering search queries. It includes optional features like search icon, keyboard shortcuts, and custom content. + +import { DocsPage } from "@/components/docs-page"; + +`} +/> + +## Usage + +```typescript jsx +import { SearchBox } from '@harnessio/ui/components' + +return ( + +) +``` + +## API Reference + +### SearchBox + +The `SearchBox` component serves as the main container for the search box element. + + void", + }, + { + name: "onFocus", + description: "Function to handle focus action", + required: false, + value: "() => void", + }, + { + name: "handleChange", + description: "Function to handle input change", + required: false, + value: "ChangeEventHandler", + }, + { + name: "showOnFocus", + description: "Whether to show the search box on focus", + required: false, + value: "boolean", + defaultValue: "false", + }, + { + name: "defaultValue", + description: "The default value of the search box", + required: false, + value: "InputHTMLAttributes['defaultValue']", + }, + { + name: "value", + description: "The current value of the search box", + required: false, + value: "InputHTMLAttributes['value']", + }, + { + name: "className", + description: "Additional class names for the search box", + required: false, + value: "string", + }, + { + name: "inputClassName", + description: "Additional class names for the input element", + required: false, + value: "string", + }, + { + name: "children", + description: "Custom content to display inside the search box", + required: false, + value: "ReactNode", + }, + ]} +/> diff --git a/apps/portal/src/content/docs/components/select.mdx b/apps/portal/src/content/docs/components/select.mdx new file mode 100644 index 0000000000..e97148b30c --- /dev/null +++ b/apps/portal/src/content/docs/components/select.mdx @@ -0,0 +1,256 @@ +--- +title: Select +description: Select component documentation +--- + +The Select component provides a UI element for selecting an option from a dropdown list. It includes optional features like labels, error states, and captions. + +import { DocsPage } from "@/components/docs-page"; + + + + + Group 1 + Option 1 + Option 2 + + + + Group 2 + Option 3 + Option 4 + + + `} +/> + +## Usage + +```typescript jsx +import { Select, SelectGroup, SelectLabel, SelectItem, SelectSeparator } from '@harnessio/ui/components' + +return ( + +) +``` + +## Anatomy + +The Select component can be used to select an option from a dropdown list with optional features like labels, error states, and captions. + +```typescript jsx + +``` + +## API Reference + +### Select + +The `Select` component serves as the main container for the select element. + + + +### SelectTrigger + +The `SelectTrigger` component is used to display the trigger button for the select dropdown. + + + +### SelectContent + +The `SelectContent` component is used to display the content container for the select dropdown. + + + +### SelectLabel + +The `SelectLabel` component is used to display a label for grouping select items. + + + +### SelectItem + +The `SelectItem` component is used to display an individual selectable item within the dropdown. + + + +### SelectSeparator + +The `SelectSeparator` component is used to display a visual separator between select items. + + diff --git a/apps/portal/src/content/docs/components/sha-badge.mdx b/apps/portal/src/content/docs/components/sha-badge.mdx new file mode 100644 index 0000000000..0a6f086391 --- /dev/null +++ b/apps/portal/src/content/docs/components/sha-badge.mdx @@ -0,0 +1,132 @@ +--- +title: SHA Badge +description: SHA Badge component documentation +--- + +The SHA Badge component provides a UI element for displaying a commit SHA with optional actions. It includes a root container, content area, and an icon button. + +import { DocsPage } from "@/components/docs-page"; + + + + + abc1234 + + console.log('Icon clicked')}> + + + + + `} +/> + +## Usage + +```typescript jsx +import { ShaBadge } from '@harnessio/ui/components' + +return ( + + + abc1234 + + console.log('Icon clicked')}> + + + +) +``` + +## Anatomy + +The SHA Badge component can be used to display a commit SHA with optional actions. + +```typescript jsx + + + abc1234 + + console.log('Icon clicked')}> + + + +``` + +## API Reference + +### ShaBadge.Root + +The `Root` component serves as the main container for the SHA badge. + + + +### ShaBadge.Content + +The `Content` component is used to display the content of the SHA badge. + + + +### ShaBadge.Icon + +The `Icon` component is used to display an icon button inside the SHA badge. + + void", + }, + { + name: "className", + description: "Additional class names for the icon button", + required: false, + value: "string", + }, + ]} +/> diff --git a/apps/portal/src/content/docs/components/spacer.mdx b/apps/portal/src/content/docs/components/spacer.mdx new file mode 100644 index 0000000000..a2b85134c2 --- /dev/null +++ b/apps/portal/src/content/docs/components/spacer.mdx @@ -0,0 +1,51 @@ +--- +title: Spacer +description: Spacer component documentation +--- + +The Spacer component provides a UI element for adding vertical spacing between elements. It includes various size options. + +import { DocsPage } from "@/components/docs-page"; + + +
Element 1
+ +
Element 2
+`} +/> + +## Usage + +```typescript jsx +import { Spacer } from '@harnessio/ui/components' + +return ( +
+
Element 1
+ +
Element 2
+
+) +``` + +## API Reference + + diff --git a/apps/portal/src/content/docs/components/stacked-list.mdx b/apps/portal/src/content/docs/components/stacked-list.mdx new file mode 100644 index 0000000000..ca65ce626e --- /dev/null +++ b/apps/portal/src/content/docs/components/stacked-list.mdx @@ -0,0 +1,201 @@ +--- +title: Stacked List +description: Stacked List component documentation +--- + +The Stacked List component provides a UI element for displaying a list of items in a stacked layout. It includes various customization options. + +import { DocsPage } from "@/components/docs-page"; + + + + + + } actions={} > + + + `} +/> + +## Usage + +```typescript jsx +import { StackedList } from '@harnessio/ui/components' + +return ( + + + + + } actions={} > + + + +) +``` + +## Anatomy + +The Stacked List component can be used to display a list of items in a stacked layout with various customization options. + +```typescript jsx + + + + + } actions={} > + + + +``` + +## API Reference + +### StackedList.Root + +The `Root` component serves as the main container for the stacked list. + + + +### StackedList.Item + +The `Item` component is used to display an individual item in the stacked list. + + + +### StackedList.Field + +The `Field` component is used to display a field inside the stacked list item. + + diff --git a/apps/portal/src/content/docs/components/styled-link.mdx b/apps/portal/src/content/docs/components/styled-link.mdx new file mode 100644 index 0000000000..9e23436fe9 --- /dev/null +++ b/apps/portal/src/content/docs/components/styled-link.mdx @@ -0,0 +1,48 @@ +--- +title: Styled Link +description: Styled Link component documentation +--- + +The Styled Link component provides a UI element for creating styled links using `react-router-dom`. It includes optional features like custom class names. + +import { DocsPage } from "@/components/docs-page"; + +Example Link`} +/> + +## Usage + +```typescript jsx +import { StyledLink } from '@harnessio/ui/components' + +return ( + Example Link +) +``` + +## API Reference + + diff --git a/apps/portal/src/content/docs/components/table.mdx b/apps/portal/src/content/docs/components/table.mdx new file mode 100644 index 0000000000..ddb35c229a --- /dev/null +++ b/apps/portal/src/content/docs/components/table.mdx @@ -0,0 +1,289 @@ +--- +title: Table +description: Table component documentation +--- + +The Table component provides a UI element for displaying tabular data. It includes various subcomponents such as TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, and TableCaption to offer a structured and customizable interface. + +import { DocsPage } from "@/components/docs-page"; + + + + + Header 1 + Header 2 + + + + + Data 1 + Data 2 + + + Data 3 + Data 4 + + + + + Footer 1 + Footer 2 + + +`} +/> + +## Usage + +```typescript jsx +import { Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell } from '@harnessio/ui/components' + +return ( + + + + Header 1 + Header 2 + + + + + Data 1 + Data 2 + + + Data 3 + Data 4 + + + + + Footer 1 + Footer 2 + + +
+) +``` + +## Anatomy + +The Table component can be used to display tabular data with various subcomponents for a structured and customizable interface. + +```typescript jsx + + + + Header 1 + Header 2 + + + + + Data 1 + Data 2 + + + Data 3 + Data 4 + + + + + Footer 1 + Footer 2 + + +
+``` + +## API Reference + +### Table + +The `Table` component serves as the main container for displaying tabular data. + + + +### TableHeader + +The `TableHeader` component is used to define the header section of the table. + + + +### TableBody + +The `TableBody` component is used to define the body section of the table. + + + +### TableFooter + +The `TableFooter` component is used to define the footer section of the table. + + + +### TableRow + +The `TableRow` component is used to define a row in the table. + + + +### TableHead + +The `TableHead` component is used to define a header cell in the table. + + + +### TableCell + +The `TableCell` component is used to define a cell in the table. + + + +### TableCaption + +The `TableCaption` component is used to define a caption for the table. + + diff --git a/apps/portal/src/content/docs/components/tabs.mdx b/apps/portal/src/content/docs/components/tabs.mdx new file mode 100644 index 0000000000..a2d6e21b9d --- /dev/null +++ b/apps/portal/src/content/docs/components/tabs.mdx @@ -0,0 +1,237 @@ +--- +title: Tabs +description: Tabs component documentation +--- + +The Tabs component provides a UI element for creating tabbed navigation interfaces. It includes various styles and sizes. + +import { DocsPage } from "@/components/docs-page"; + + +
+

Default Variant

+ + + Tab 1 + Tab 2 + + Content for Tab 1 + Content for Tab 2 + +
+
+

Underline Variant

+ + + + Tab 1 + Tab 2 + + Content for Tab 1 + Content for Tab 2 + +
+
+

Navigation Variant

+ + + + Tab 1 + Tab 2 + + Content for Tab 1 + Content for Tab 2 + +
+
+

Tabnav Variant

+ + + Tab 1 + Tab 2 + + Content for Tab 1 + Content for Tab 2 + +
+`} +/> + +## Usage + +```typescript jsx +import { Tabs, TabsList, TabsTrigger, TabsContent } from '@harnessio/ui/components' + +return ( + + + Tab 1 + Tab 2 + + Content for Tab 1 + Content for Tab 2 + +) +``` + +## Anatomy + +The Tabs component can be used to create tabbed navigation interfaces with various styles and sizes. + +```typescript jsx + + + Tab 1 + Tab 2 + + Content for Tab 1 + Content for Tab 2 + +``` + +## API Reference + +### Tabs + +The `Tabs` component serves as the main container for the tabs element. + + void", + }, + { + name: "variant", + description: "The variant of the tabs", + required: false, + type: "'default' | 'underline' | 'navigation' | 'tabnav'", + defaultValue: "'default'", + }, + { + name: "className", + description: "Additional class names for the tabs", + required: false, + type: "string", + }, + ]} +/> + +### TabsList + +The `TabsList` component is used to display the list of tab triggers. + + + +### TabsTrigger + +The `TabsTrigger` component is used to display an individual tab trigger. + + + +### TabsContent + +The `TabsContent` component is used to display the content of a tab. + + diff --git a/apps/portal/src/content/docs/components/text.mdx b/apps/portal/src/content/docs/components/text.mdx new file mode 100644 index 0000000000..712b7b6fc3 --- /dev/null +++ b/apps/portal/src/content/docs/components/text.mdx @@ -0,0 +1,134 @@ +--- +title: Text +description: Text component documentation +--- + +The Text component provides a UI element for displaying text with various styles and properties. It includes options for alignment, size, weight, color, and more. + +import { DocsPage } from "@/components/docs-page"; + + + Example Text + + Another Example Text + + Yet Another Example Text +`} +/> + +## Usage + +```typescript jsx +import { Text } from '@harnessio/ui/components' + +return ( + <> + Example Text +
+ Another Example Text +
+ Yet Another Example Text + +) +``` + +## Anatomy + +The Text component can be used to display text with various styles and properties. + +```typescript jsx +<> + Example Text +
+ Another Example Text +
+ Yet Another Example Text + +``` + +## API Reference + +### Text + +The `Text` component serves as the main container for displaying text with various styles and properties. + + diff --git a/apps/portal/src/content/docs/components/textarea.mdx b/apps/portal/src/content/docs/components/textarea.mdx new file mode 100644 index 0000000000..2b1aac7055 --- /dev/null +++ b/apps/portal/src/content/docs/components/textarea.mdx @@ -0,0 +1,122 @@ +--- +title: Textarea +description: Textarea component documentation +--- + +The Textarea component provides a UI element for entering multi-line text. It includes optional features like labels, captions, and error messages. + +import { DocsPage } from "@/components/docs-page"; + +`} +/> + +## Usage + +```typescript jsx +import { Textarea } from '@harnessio/ui/components' + +return ( +