import type { Meta, StoryObj } from '@storybook/nextjs' import { useState } from 'react' import { RiCloudLine, RiCpuLine, RiDatabase2Line, RiLightbulbLine, RiRocketLine, RiShieldLine } from '@remixicon/react' import RadioCard from '.' const meta = { title: 'Base/Data Entry/RadioCard', component: RadioCard, parameters: { layout: 'centered', docs: { description: { component: 'Radio card component for selecting options with rich content. Features icon, title, description, and optional configuration panel when selected.', }, }, }, tags: ['autodocs'], argTypes: { icon: { description: 'Icon element to display', }, iconBgClassName: { control: 'text', description: 'Background color class for icon container', }, title: { control: 'text', description: 'Card title', }, description: { control: 'text', description: 'Card description', }, isChosen: { control: 'boolean', description: 'Whether the card is selected', }, noRadio: { control: 'boolean', description: 'Hide the radio button indicator', }, }, } satisfies Meta export default meta type Story = StoryObj // Single card demo const RadioCardDemo = (args: any) => { const [isChosen, setIsChosen] = useState(args.isChosen || false) return (
setIsChosen(!isChosen)} />
) } // Default state export const Default: Story = { render: args => , args: { icon: , iconBgClassName: 'bg-purple-100', title: 'Quick Start', description: 'Get started quickly with default settings', isChosen: false, noRadio: false, }, } // Selected state export const Selected: Story = { render: args => , args: { icon: , iconBgClassName: 'bg-purple-100', title: 'Quick Start', description: 'Get started quickly with default settings', isChosen: true, noRadio: false, }, } // Without radio indicator export const NoRadio: Story = { render: args => , args: { icon: , iconBgClassName: 'bg-purple-100', title: 'Information Card', description: 'Card without radio indicator', noRadio: true, }, } // With configuration panel const WithConfigurationDemo = () => { const [isChosen, setIsChosen] = useState(true) return (
} iconBgClassName="bg-blue-100" title="Database Storage" description="Store data in a managed database" isChosen={isChosen} onChosen={() => setIsChosen(!isChosen)} chosenConfig={
} />
) } export const WithConfiguration: Story = { render: () => , parameters: { controls: { disable: true } }, } as unknown as Story // Multiple cards selection const MultipleCardsDemo = () => { const [selected, setSelected] = useState('standard') const options = [ { value: 'standard', icon: , iconBg: 'bg-purple-100', title: 'Standard', description: 'Perfect for most use cases', }, { value: 'advanced', icon: , iconBg: 'bg-blue-100', title: 'Advanced', description: 'More features and customization', }, { value: 'enterprise', icon: , iconBg: 'bg-green-100', title: 'Enterprise', description: 'Full features with premium support', }, ] return (
{options.map(option => ( setSelected(option.value)} /> ))}
Selected: {selected}
) } export const MultipleCards: Story = { render: () => , parameters: { controls: { disable: true } }, } as unknown as Story // Real-world example - Cloud provider selection const CloudProviderSelectionDemo = () => { const [provider, setProvider] = useState('aws') const [region, setRegion] = useState('us-east-1') return (

Select Cloud Provider

} iconBgClassName="bg-orange-100" title="Amazon Web Services" description="Industry-leading cloud infrastructure" isChosen={provider === 'aws'} onChosen={() => setProvider('aws')} chosenConfig={
} /> } iconBgClassName="bg-blue-100" title="Microsoft Azure" description="Enterprise-grade cloud platform" isChosen={provider === 'azure'} onChosen={() => setProvider('azure')} /> } iconBgClassName="bg-red-100" title="Google Cloud Platform" description="Scalable and reliable infrastructure" isChosen={provider === 'gcp'} onChosen={() => setProvider('gcp')} />
) } export const CloudProviderSelection: Story = { render: () => , parameters: { controls: { disable: true } }, } as unknown as Story // Real-world example - Deployment strategy const DeploymentStrategyDemo = () => { const [strategy, setStrategy] = useState('rolling') return (

Deployment Strategy

Choose how you want to deploy your application

} iconBgClassName="bg-green-100" title="Rolling Deployment" description="Gradually replace instances with zero downtime" isChosen={strategy === 'rolling'} onChosen={() => setStrategy('rolling')} chosenConfig={
✓ Recommended for production environments
✓ Minimal risk with automatic rollback
✓ Takes 5-10 minutes
} /> } iconBgClassName="bg-blue-100" title="Blue-Green Deployment" description="Switch between two identical environments" isChosen={strategy === 'blue-green'} onChosen={() => setStrategy('blue-green')} chosenConfig={
✓ Instant rollback capability
✓ Requires double the resources
✓ Takes 2-5 minutes
} /> } iconBgClassName="bg-yellow-100" title="Canary Deployment" description="Test with a small subset of users first" isChosen={strategy === 'canary'} onChosen={() => setStrategy('canary')} chosenConfig={
✓ Test changes with real traffic
✓ Gradual rollout reduces risk
✓ Takes 15-30 minutes
} />
) } export const DeploymentStrategy: Story = { render: () => , parameters: { controls: { disable: true } }, } as unknown as Story // Real-world example - Storage options const StorageOptionsDemo = () => { const [storage, setStorage] = useState('ssd') const storageOptions = [ { value: 'ssd', icon: , iconBg: 'bg-purple-100', title: 'SSD Storage', description: 'Fast and reliable solid state drives', price: '$0.10/GB/month', speed: 'Up to 3000 IOPS', }, { value: 'hdd', icon: , iconBg: 'bg-gray-100', title: 'HDD Storage', description: 'Cost-effective magnetic disk storage', price: '$0.05/GB/month', speed: 'Up to 500 IOPS', }, { value: 'nvme', icon: , iconBg: 'bg-red-100', title: 'NVMe Storage', description: 'Ultra-fast PCIe-based storage', price: '$0.20/GB/month', speed: 'Up to 10000 IOPS', }, ] const selectedOption = storageOptions.find(opt => opt.value === storage) return (

Storage Type

{storageOptions.map(option => ( {option.title} {option.price}
} description={`${option.description} - ${option.speed}`} isChosen={storage === option.value} onChosen={() => setStorage(option.value)} /> ))}
{selectedOption && (
Selected: {selectedOption.title}
{selectedOption.price} • {selectedOption.speed}
)} ) } export const StorageOptions: Story = { render: () => , parameters: { controls: { disable: true } }, } as unknown as Story // Real-world example - API authentication method const APIAuthMethodDemo = () => { const [authMethod, setAuthMethod] = useState('api_key') const [apiKey, setApiKey] = useState('') return (

API Authentication

} iconBgClassName="bg-blue-100" title="API Key" description="Simple authentication using a secret key" isChosen={authMethod === 'api_key'} onChosen={() => setAuthMethod('api_key')} chosenConfig={
setApiKey(e.target.value)} />

Keep your API key secure and never share it publicly

} /> } iconBgClassName="bg-green-100" title="OAuth 2.0" description="Industry-standard authorization protocol" isChosen={authMethod === 'oauth'} onChosen={() => setAuthMethod('oauth')} chosenConfig={

Configure OAuth 2.0 authentication for secure access

} /> } iconBgClassName="bg-purple-100" title="JWT Token" description="JSON Web Token based authentication" isChosen={authMethod === 'jwt'} onChosen={() => setAuthMethod('jwt')} chosenConfig={
JWT tokens provide stateless authentication with expiration and refresh capabilities
} />
) } export const APIAuthMethod: Story = { render: () => , parameters: { controls: { disable: true } }, } as unknown as Story // Interactive playground const PlaygroundDemo = () => { const [selected, setSelected] = useState('option1') return (
} iconBgClassName="bg-purple-100" title="Option 1" description="First option with icon and description" isChosen={selected === 'option1'} onChosen={() => setSelected('option1')} /> } iconBgClassName="bg-blue-100" title="Option 2" description="Second option with different styling" isChosen={selected === 'option2'} onChosen={() => setSelected('option2')} chosenConfig={
Additional configuration appears when selected
} /> } iconBgClassName="bg-green-100" title="Option 3" description="Third option to demonstrate selection" isChosen={selected === 'option3'} onChosen={() => setSelected('option3')} />
) } export const Playground: Story = { render: () => , parameters: { controls: { disable: true } }, } as unknown as Story