diff --git a/app/templates/shared/macros/avatars.html b/app/templates/shared/macros/avatars.html new file mode 100644 index 00000000..0fb65301 --- /dev/null +++ b/app/templates/shared/macros/avatars.html @@ -0,0 +1,373 @@ +{# + Avatar Macros + ============= + Reusable avatar components for user profile images. + + Usage: + {% from 'shared/macros/avatars.html' import avatar, avatar_with_status, avatar_group, avatar_initials %} + + {# Basic avatar with image #} + {{ avatar(src='user.avatar_url', alt='user.name', size='md') }} + + {# Avatar with online status #} + {{ avatar_with_status(src='user.avatar', status='online', size='lg') }} + + {# Avatar group (stacked) #} + {% call avatar_group(max=3) %} + {{ avatar(src='url1', size='sm') }} + {{ avatar(src='url2', size='sm') }} + {{ avatar(src='url3', size='sm') }} + {% endcall %} + + {# Initials fallback #} + {{ avatar_initials(initials='JD', size='md', color='purple') }} +#} + + +{# + Avatar + ====== + A basic avatar component. + + Parameters: + - src: Image source (static string or Alpine.js expression with :src) + - alt: Alt text + - size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' (default: 'md') + - rounded: 'full' | 'lg' | 'md' (default: 'full') + - fallback_icon: Icon to show if no image (default: 'user') + - dynamic: Whether src is an Alpine.js expression (default: false) + - class_extra: Additional CSS classes +#} +{% macro avatar(src='', alt='', size='md', rounded='full', fallback_icon='user', dynamic=false, class_extra='') %} +{% set sizes = { + 'xs': 'w-6 h-6', + 'sm': 'w-8 h-8', + 'md': 'w-10 h-10', + 'lg': 'w-12 h-12', + 'xl': 'w-14 h-14', + '2xl': 'w-16 h-16' +} %} +{% set icon_sizes = { + 'xs': 'w-3 h-3', + 'sm': 'w-4 h-4', + 'md': 'w-5 h-5', + 'lg': 'w-6 h-6', + 'xl': 'w-7 h-7', + '2xl': 'w-8 h-8' +} %} +{% set roundeds = { + 'full': 'rounded-full', + 'lg': 'rounded-lg', + 'md': 'rounded-md' +} %} +
{{ subtitle }}
+ {% endif %} ++ Click to upload or drag and drop +
+ {% if help %} +{{ help }}
+ {% elif max_size %} +Max file size: {{ max_size }}MB
+ {% endif %} +Modal content here
+ {% endcall %} + + {# Confirmation modal #} + {{ confirm_modal('deleteModal', 'Delete User', 'Are you sure?', 'deleteUser()', 'isDeleteModalOpen') }} + + Required Alpine.js: + x-data="{ isModalOpen: false }" +#} + + +{# + Modal + ===== + A flexible modal dialog component. + + Parameters: + - id: Unique modal ID + - title: Modal title + - show_var: Alpine.js variable controlling visibility (default: 'isModalOpen') + - size: 'sm' | 'md' | 'lg' | 'xl' | 'full' (default: 'md') + - show_close: Whether to show close button (default: true) + - show_footer: Whether to show footer slot (default: true) + - close_on_backdrop: Close when clicking backdrop (default: true) + - close_on_escape: Close on Escape key (default: true) +#} +{% macro modal(id, title, show_var='isModalOpen', size='md', show_close=true, show_footer=true, close_on_backdrop=true, close_on_escape=true) %} +{% set sizes = { + 'sm': 'max-w-sm', + 'md': 'max-w-lg', + 'lg': 'max-w-2xl', + 'xl': 'max-w-4xl', + 'full': 'max-w-full mx-4' +} %} ++ {{ message }} +
+