From 102e0110f5d57a0d396a8643ab4b79a15d8b4e97 Mon Sep 17 00:00:00 2001 From: Ahmad Rafi Wirana Date: Sat, 17 Aug 2024 14:42:30 +0700 Subject: [PATCH] feat: improve list component --- components/List/ListDocumentation.tsx | 17 +-- components/List/ListPageClient.tsx | 185 +++++++++++++++++--------- 2 files changed, 134 insertions(+), 68 deletions(-) diff --git a/components/List/ListDocumentation.tsx b/components/List/ListDocumentation.tsx index 6cc42c8..1d0ead3 100644 --- a/components/List/ListDocumentation.tsx +++ b/components/List/ListDocumentation.tsx @@ -4,8 +4,8 @@ const ListDocumentation = () => { return ( <> {/* Props Section */} -
-

Props

+
+

Props

@@ -19,34 +19,35 @@ const ListDocumentation = () => { - + - + - + - + - +
itemsArray<{`{ content: React.ReactNode, icon?: React.ReactNode }`}>List[content: React.ReactNode, icon: React.ReactNode] -Array of items to be displayed in the list. Each item can have content and an optional icon.Array of items to be displayed in the list, either a content or an icon.
variant {`"ordered" | "unordered"`} {`"unordered"`}Determines whether the list is ordered (ol) or unordered (ul).Type of list: ordered (ol) or unordered (ul).
className stringempty- Additional classes for styling the list.
iconClassName stringempty- Additional classes for styling the icons.
+ {/* Best Practices Section */} -
+

Best Practices

    diff --git a/components/List/ListPageClient.tsx b/components/List/ListPageClient.tsx index 8ed94df..11cfc2e 100644 --- a/components/List/ListPageClient.tsx +++ b/components/List/ListPageClient.tsx @@ -1,8 +1,14 @@ 'use client'; import React from 'react'; + +import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; +import { materialLight } from 'react-syntax-highlighter/dist/cjs/styles/prism'; import { ShoppingCart, Star, Heart } from 'lucide-react'; +import TOC from '@/components/TOC/TOC'; +import { Tabs, Tab } from '@/components/Tabs/Tabs'; + import Layout from '../Layout/Layout'; import Badge from '../Badge/Badge'; @@ -10,71 +16,130 @@ import { List, ListItem } from './List'; import ListDocumentation from './ListDocumentation'; const ListPageClient: React.FC = () => { - const items = ['Item 1', 'Item 2', 'Item 3']; + const tocItems = [ + { id: 'overview', label: 'Overview' }, + { id: 'variants', label: 'Variants' }, + { id: 'properties', label: 'Properties' }, + { id: 'best-practices', label: 'Best Practices' }, + ]; + + const codeExample = ` + + `; return ( - -
    -

    List

    -

    - A component for displaying multiple items with customizable styling and optional item icons. -

    -
    -
    -

    Variants

    -
    -
    -

    - Unordered List -

    - -
    -
    -

    - Unordered List with Icons -

    - }, - { content: 'Favorites', icon: }, - { content: 'Wishlist', icon: }, - ]} - variant="unordered" - iconClassName="text-blue-600 dark:text-blue-500" - /> -
    -
    -

    - Ordered List -

    - - First item - Second item - Third item - -
    -
    -

    - Ordered List with Icons -

    - - }>Shopping List - }>Favorites - }>Wishlist - +
    +
    + +
    +

    List

    +

    + A component for displaying multiple items with customizable styling and optional item icons. +

    + + {/* Variants Section */} +
    + + +
    +
    +
    +

    + Unordered List +

    + +
    +
    +

    + Unordered List with Icons +

    + }, + { content: 'Favorites', icon: }, + { content: 'Wishlist', icon: }, + ]} + variant="unordered" + iconClassName="text-blue-600 dark:text-blue-500" + /> +
    +
    +

    + Ordered List +

    + + First item + Second item + Third item + +
    +
    +

    + Ordered List with Icons +

    + + }>Shopping List + }>Favorites + }>Wishlist + +
    +
    +
    +
    + +
    +
    + + tsx + +
    +
    + + {codeExample} + +
    +
    +
    +
    +
    +
    -
    - + +
); };