import React from 'react';
import { Screen, View, Button, Text } from '@idealyst/components';
import { useUnistyles } from 'react-native-unistyles';
export const ButtonExamples = () => {
const handlePress = (buttonType: string) => {
console.log(`Button pressed: ${buttonType}`);
};
const { theme } = useUnistyles()
return (
Button Examples
{/* Button Variants */}
Variants
{/* Show all intents in theme (including extended intents) */}
All Intents
{ (Object.keys(theme.intents) as Array).map((intent) => (
)) }
{/* Button Sizes */}
Sizes
{/* Button Intents */}
Intents
{/* Disabled States */}
Disabled States
{/* Buttons with Icons */}
Buttons with Icons
{/* Icon-only Buttons */}
Icon-only Buttons
{/* Different Intents with Icons */}
Icons with Different Intents
handlePress('info')}
>
Info
handlePress('success')}
>
Success
handlePress('warning')}
>
Warning
handlePress('danger')}
>
Danger
{/* Gradient Overlay */}
Gradient Overlay
handlePress('no-gradient')}
>
No Gradient
handlePress('gradient-darken')}
>
Darken
handlePress('gradient-lighten')}
>
Lighten
{/* Gradient with Different Intents */}
Gradient Intents (Darken)
handlePress('gradient-primary')}
>
Primary
handlePress('gradient-success')}
>
Success
handlePress('gradient-error')}
>
Error
handlePress('gradient-warning')}
>
Warning
handlePress('gradient-neutral')}
>
Neutral
{/* Gradient with Icons */}
Gradient with Icons
handlePress('gradient-icon-launch')}
>
Launch
handlePress('gradient-icon-submit')}
>
Submit
handlePress('gradient-icon-delete')}
>
Delete
{/* Loading State */}
Loading State
handlePress('loading-contained')}
>
Loading
handlePress('loading-outlined')}
>
Loading
handlePress('loading-text')}
>
Loading
{/* Loading with Different Intents */}
Loading Intents
handlePress('loading-primary')}
>
Primary
handlePress('loading-success')}
>
Success
handlePress('loading-error')}
>
Error
handlePress('loading-warning')}
>
Warning
{/* Interactive Loading Example */}
Interactive Loading
);
};
// Interactive loading button component
const InteractiveLoadingButton = () => {
const [loading, setLoading] = React.useState(false);
const handlePress = async () => {
setLoading(true);
// Simulate async operation
await new Promise(resolve => setTimeout(resolve, 2000));
setLoading(false);
};
return (
{loading ? 'Saving...' : 'Save'}
{loading ? 'Processing...' : 'Submit'}
);
};