import { useState, useMemo, useCallback } from "react"; import clsx from 'clsx'; import { History, StarBorder, Star, Edit, Delete as DeleteIcon, } from '@mui/icons-material'; import RdsButton from "../../raaghu-elements/rds-button/rds-button"; import RdsCarousel from "../../raaghu-elements/rds-carousel/rds-carousel"; import RdsTypography from "../../raaghu-elements/rds-typography/rds-typography"; import RdsBadge from "../../raaghu-elements/rds-badge/rds-badge"; import RdsCounter from "../../raaghu-elements/rds-counter/rds-counter"; import RdsSearch from "../../raaghu-elements/rds-search/rds-search"; import RdsAvatar from "../../raaghu-elements/rds-avatar/rds-avatar"; import RdsAccordion from "../../raaghu-elements/rds-accordion/rds-accordion"; import RdsRadio from "../../raaghu-elements/rds-radio/rds-radio"; import RdsCheckbox from "../../raaghu-elements/rds-checkbox/rds-checkbox"; import RdsCompTreeStructure, { IconType, TreeLevel } from '../rds-comp-tree-structure/rds-comp-tree-structure'; export interface HistoryFavoriteTabsProps { activeTab: string; setActiveTab: (tab: string) => void; historyTabLabel?: string; favouritesTabLabel?: string; addtoscreen?: string; addtofolder?: string; style?: string; historyItems: { id: number; name: string }[]; olderHistoryItems: { id: number; name: string }[]; handleDeleteHistoryItem: (id: number) => void; handleDeleteOlderHistoryItem: (id: number) => void; favouriteCardTitle?: string; favouriteCardImage?: string; } export interface RealEstateContentProps { estateTitle?: string; estateDescription?: string; carouselImages?: { src: string; alt: string }[]; } export interface SelectionContentProps { headerText?: string; headerSubText?: string; } export interface ToolbarContentProps { initialTab?: string; figmaIconSrc?: string; storybookIconSrc?: string; } const TOOLBAR_TABS = [ { id: 'icon_font', ariaLabel: 'Font settings' }, { id: 'icon_color', ariaLabel: 'Color settings' }, { id: 'icon_frame', ariaLabel: 'Corner radius settings' }, { id: 'icon_line_height', ariaLabel: 'Spacing settings' }, { id: 'icon_block', ariaLabel: 'Block settings' }, ] as const; export interface ThumbnailViewContentProps { thumbnailButtonName?: string; } export interface FigmaUIKitButtonProps { text?: string; onClick?: () => void; className?: string; storybookIconSrc?: string; figmaIconSrc?: string; iconAlt?: string; } export interface StorybookButtonProps { text?: string; onClick?: () => void; className?: string; figmaIconSrc?: string; storybookIconSrc?: string; iconAlt?: string; } const EMPTY_HISTORY_ITEMS: { id: number; name: string }[] = []; const EMPTY_CAROUSEL_IMAGES: { src: string; alt: string }[] = []; export const FigmaUIKitButton = ({ text = "Download the Figma UI Kit", onClick, figmaIconSrc, storybookIconSrc, iconAlt = "Figma", className = "" }) => { return ( {figmaIconSrc && ( )} {text} ); }; export const StorybookButton = ({ text = "Go to Storybook", onClick, className = "", figmaIconSrc, storybookIconSrc, iconAlt = "Storybook" }) => { return ( {storybookIconSrc && ( )} {text} ); }; export const HistoryFavoritesTabs = ({ activeTab, setActiveTab, historyTabLabel = "History", favouritesTabLabel = "Favourites", addtoscreen = "Add to screen", addtofolder = "Add to folder", style, historyItems, olderHistoryItems, handleDeleteHistoryItem, handleDeleteOlderHistoryItem, favouriteCardTitle = 'Create a Login page for signing up with a discount offer. It should have a field for the user\'s email and a "Get Discount" button.', favouriteCardImage = "https://dummyimage.com/400x260/007bff/ffffff&text=Login+Page", }) => { const [selectedIndexes, setSelectedIndexes] = useState([]); const resolvedHistoryItems = historyItems ?? EMPTY_HISTORY_ITEMS; const resolvedOlderHistoryItems = olderHistoryItems ?? EMPTY_HISTORY_ITEMS; const TABS = useMemo(() => [ { key: "history", label: historyTabLabel, icon: }, { key: "favourites", label: favouritesTabLabel, icon: }, ], [favouritesTabLabel, historyTabLabel]); const toggleSelection = useCallback((idx: number) => { setSelectedIndexes(prev => prev.includes(idx) ? prev.filter(i => i !== idx) : [...prev, idx] ); }, []); const renderHistoryItem = useCallback((item: { id: number; name: string }, handleDelete: (id: number) => void) => ( {item.name} handleDelete(item.id)} className="rds-comp-details-pane__icon-delete" aria-label={`Delete ${item.name}`} /> ), []); return ( {TABS.map((tab) => ( setActiveTab(tab.key)} > {tab.icon} {tab.label} ))} {activeTab === "history" && ( Today {resolvedHistoryItems.map(item => renderHistoryItem(item, handleDeleteHistoryItem))} Older {resolvedOlderHistoryItems.map(item => renderHistoryItem(item, handleDeleteOlderHistoryItem))} )} {activeTab === "favourites" && ( {["fav-card-1", "fav-card-2"].map((cardKey, idx) => ( toggleSelection(idx)} onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggleSelection(idx); } }} > , checked?: boolean) => { e.stopPropagation(); toggleSelection(idx); }} /> {favouriteCardTitle} ))} )} {activeTab === "favourites" && ( {style === "Favourites - New Folder" ? ( ) : ( )} )} ); }; const REAL_ESTATE_BADGES: { content: string; color: "primary" | "secondary" | "success" | "default" | "error" | "info" | "warning"; size: "small" | "medium" | "large"; shape?: "rectangle" | "pill" }[] = [ { content: "O Badge", color: "primary", size: "small", shape: "rectangle" }, { content: "O Badge", color: "primary", size: "small", shape: "rectangle" }, { content: "O Badge", color: "primary", size: "small", shape: "rectangle" } ]; export const RealEstateContent = ({ estateTitle, estateDescription, carouselImages }) => { const resolvedCarouselImages = carouselImages ?? EMPTY_CAROUSEL_IMAGES; const badges = REAL_ESTATE_BADGES; return ( {resolvedCarouselImages.map((image, index) => ( ))} {estateTitle} {badges.map((badge) => ( ))} {estateDescription} 1 Adult, 0 Children ); }; const SELECTION_AGENTS = [ { id: 1, name: "Jane Doe", designation: "Designation", avatar: "https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=150&h=150&fit=crop&crop=face", count: 4 }, { id: 2, name: "Jane Doe", designation: "Designation", avatar: "https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=150&h=150&fit=crop&crop=face", count: 4 }, { id: 3, name: "Jane Doe", designation: "Designation", avatar: "https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=150&h=150&fit=crop&crop=face", count: 4 } ]; export const SelectionContent = ({ headerSubText = "Agent Information" }) => { const agents = SELECTION_AGENTS; const [searchValue, setSearchValue] = useState(""); const [selectedAgent, setSelectedAgent] = useState(null); const handleSearchChange = useCallback((value: string) => setSearchValue(value), []); const handleAgentSelect = useCallback((agentId: string) => setSelectedAgent(agentId), []); const handleAgentCardKeyDown = useCallback((e: KeyboardEvent, agentId: string) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); setSelectedAgent(agentId); } }, []); return ( Bayshore Transportation System {headerSubText} {agents.map((agent) => ( handleAgentSelect(String(agent.id))} onKeyDown={(e) => handleAgentCardKeyDown(e, String(agent.id))} > {agent.count} ) => { const parsed = typeof val === 'object' && val?.target ? String(val.target.value) : String(val); handleAgentSelect(parsed); }} options={[ { text: '', value: String(agent.id), }, ]} radioProps={{ name: 'agent-selection' }} state="default" value={selectedAgent} /> ))} ); }; export const ToolbarContent = ({ initialTab = 'icon_font', figmaIconSrc, storybookIconSrc }) => { const [toolbarState, setToolbarState] = useState({ activeToolbarTab: initialTab, selectedFontSize: 16, selectedFontWeight: 'Regular', selectedCornerRadius: 0 as string | number, selectedSpacingSize: 0 as number | string, }); const { activeToolbarTab, selectedFontSize, selectedFontWeight, selectedCornerRadius, selectedSpacingSize } = toolbarState; const updateToolbarState = (updates: Partial) => { setToolbarState((prev) => ({ ...prev, ...updates })); }; return ( <> Toolbar {TOOLBAR_TABS.map((tab) => { const isSelected = activeToolbarTab === tab.id; return ( updateToolbarState({ activeToolbarTab: tab.id })} > )})} {activeToolbarTab === 'icon_font' && ( Font Name : Poppins Font Size {[14, 16, 18, 20, 24].map(size => ( updateToolbarState({ selectedFontSize: size })} > {size} ))} {[32, 36, 48, 60, 72].map(size => ( updateToolbarState({ selectedFontSize: size })} > {size} ))} Font Weight {['Regular', 'Medium'].map(weight => ( updateToolbarState({ selectedFontWeight: weight })} > {weight} ))} {['Semi Bold', 'Bold'].map(weight => ( updateToolbarState({ selectedFontWeight: weight })} > {weight} ))} )} {activeToolbarTab === 'icon_color' && ( Your Color Palette )} {activeToolbarTab === 'icon_frame' && ( Corner Radius Size {[0, 2, 4, 6, 8].map(size => ( updateToolbarState({ selectedCornerRadius: size })} > {size} ))} {[12, 24, 48, 96, 'MAX'].map(size => ( updateToolbarState({ selectedCornerRadius: size })} > {size} ))} )} {activeToolbarTab === 'icon_line_height' && ( Spacing Size {[0, 2, 4, 6, 8].map(size => ( updateToolbarState({ selectedSpacingSize: size })} > {size} ))} {[12, 24, 48, 96, 'MAX'].map(size => ( updateToolbarState({ selectedSpacingSize: size })} > {size} ))} )} {activeToolbarTab === 'icon_block' && ( Component List )} { }} className="rds-comp-details-pane__figma-button" figmaIconSrc={figmaIconSrc} iconAlt="Figma" /> { }} className="rds-comp-details-pane__storybook-button" storybookIconSrc={storybookIconSrc} iconAlt="Storybook" /> > ); }; const THUMBNAIL_ACCORDION_ITEMS = [ { id: "thumb-1", title: "Title", imgSrc: "https://images.unsplash.com/photo-1506744038136-46273834b3fb?auto=format&fit=crop&w=800&q=80" }, { id: "thumb-2", title: "Title", imgSrc: "https://images.unsplash.com/photo-1506744038136-46273834b3fb?auto=format&fit=crop&w=800&q=80" }, { id: "thumb-3", title: "Title", imgSrc: "https://images.unsplash.com/photo-1506744038136-46273834b3fb?auto=format&fit=crop&w=800&q=80" } ]; export const ThumbnailViewContent = ({ thumbnailButtonName }) => { const accordionItems = THUMBNAIL_ACCORDION_ITEMS; return ( Pages {thumbnailButtonName || "Download Project"} {accordionItems.map((item) => ( ))} ); }; FigmaUIKitButton.displayName = 'FigmaUIKitButton'; StorybookButton.displayName = 'StorybookButton'; HistoryFavoritesTabs.displayName = 'HistoryFavoritesTabs'; RealEstateContent.displayName = 'RealEstateContent'; SelectionContent.displayName = 'SelectionContent'; ToolbarContent.displayName = 'ToolbarContent'; ThumbnailViewContent.displayName = 'ThumbnailViewContent';
{headerSubText}
Font Name : Poppins
Font Size
Font Weight