{% extends "base.html" %} {% from 'partials/_buttons.html' import button, icon_button, close_button, button_group, tag_button %} {% from 'partials/_modals.html' import simple_modal, confirm_dialog, alert_modal %} {% from 'partials/_forms.html' import text_input, textarea, select, checkbox, radio_group, number_input, file_input %} {% from 'partials/_card_display.html' import card_thumb, card_flip_button, card_grid %} {% from 'partials/_panels.html' import panel, simple_panel, info_panel, stat_panel, collapsible_panel, empty_state_panel, loading_panel %} {% block title %}Component Library - MTG Deckbuilder{% endblock %} {% block content %}
{{ simple_panel( title='Table of Contents', content=' ', variant='alt' ) }}
{% call panel(title='Buttons', padding='lg') %}

Button Variants

{{ button('Primary Button', variant='primary') }} {{ button('Secondary Button', variant='secondary') }} {{ button('Ghost Button', variant='ghost') }} {{ button('Danger Button', variant='danger') }}

Button Sizes

{{ button('Small', size='sm') }} {{ button('Medium (Default)', size='md') }} {{ button('Large', size='lg') }}

Icon Buttons

{{ icon_button('×', aria_label='Close', size='sm') }} {{ icon_button('☰', aria_label='Menu', size='md') }} {{ icon_button('⚙', aria_label='Settings', size='lg') }}

Tag Buttons

{{ tag_button('Ramp') }} {{ tag_button('Removal', selected=True) }} {{ tag_button('Card Draw', removable=True, on_remove='alert("Tag removed")') }} {{ tag_button('Counterspells') }}

Button Groups

{{ button_group([ {'text': 'Back', 'variant': 'secondary'}, {'text': 'Cancel', 'variant': 'ghost'}, {'text': 'Save', 'variant': 'primary', 'type': 'submit'} ], alignment='right') }}

Link Buttons

{{ button('Go Home', href='/', variant='ghost') }} {{ button('Build Deck', href='/build', variant='primary') }} {% endcall %}
{% call panel(title='Modals', padding='lg') %}

Click buttons to see modal examples

{{ button('Simple Modal', onclick='showSimpleModalExample()') }} {{ button('Confirm Dialog', onclick='showConfirmExample()') }} {{ button('Alert (Success)', onclick='showAlertExample("success")') }} {{ button('Alert (Error)', onclick='showAlertExample("error")') }}

Modal Sizes

{{ button('Small (480px)', onclick='showSizedModal("sm")') }} {{ button('Medium (620px)', onclick='showSizedModal("md")') }} {{ button('Large (720px)', onclick='showSizedModal("lg")') }} {{ button('XLarge (960px)', onclick='showSizedModal("xl")') }}
{% endcall %}
{% call panel(title='Form Components', padding='lg') %}
{{ text_input('username', label='Username', placeholder='Enter username', required=True) }} {{ text_input('email', label='Email', type='email', placeholder='you@example.com', help_text='We\'ll never share your email') }} {{ textarea('notes', label='Notes', placeholder='Enter additional notes...', rows=4) }} {{ select('color', label='Color Identity', options=[ {'value': 'W', 'text': 'White'}, {'value': 'U', 'text': 'Blue'}, {'value': 'B', 'text': 'Black'}, {'value': 'R', 'text': 'Red'}, {'value': 'G', 'text': 'Green'} ], required=True) }} {{ number_input('quantity', label='Quantity', min=1, max=10, value=1) }} {{ checkbox('owned_only', label='Show only owned cards', checked=True) }} {{ radio_group('theme', label='Preferred Theme', options=[ {'value': 'system', 'text': 'System', 'checked': True}, {'value': 'light', 'text': 'Light'}, {'value': 'dark', 'text': 'Dark'} ]) }} {{ file_input('deck_file', label='Upload Deck File', accept='.csv,.txt,.json') }}
{{ button('Cancel', variant='secondary', type='button') }} {{ button('Submit', variant='primary', type='submit') }}
{% endcall %}
{% call panel(title='Card Display Components', padding='lg') %}

Card Thumbnail Sizes

{{ card_thumb('Sol Ring', size='small', show_name=True) }} {{ card_thumb('Lightning Bolt', size='medium', show_name=True) }} {{ card_thumb('Rampant Growth', size='large', show_name=True) }}

Dual-Faced Card with Flip Button

{{ card_thumb('Delver of Secrets // Insectile Aberration', size='large', layout='transform', show_flip=True, show_name=True) }}

Card Grid

Hover over cards to see popup (desktop) or tap (mobile)

{{ card_grid([ {'name': 'Sol Ring', 'role': 'ramp', 'tags': ['Ramp', 'Artifact']}, {'name': 'Lightning Bolt', 'role': 'removal', 'tags': ['Removal', 'Instant']}, {'name': 'Rampant Growth', 'role': 'ramp', 'tags': ['Ramp', 'Sorcery']}, {'name': 'Counterspell', 'role': 'control', 'tags': ['Counterspell', 'Instant']}, {'name': 'Swords to Plowshares', 'role': 'removal', 'tags': ['Removal', 'Instant']}, {'name': 'Birds of Paradise', 'role': 'ramp', 'tags': ['Ramp', 'Creature']} ], size='medium', columns=3) }} {% endcall %}
{% call panel(title='Panel Components', padding='lg') %}

Panel Variants

{{ simple_panel(title='Default Panel', content='

This is a default panel with standard background.

', variant='default') }} {{ simple_panel(title='Alt Panel', content='

This is an alternate panel with lighter background.

', variant='alt') }} {{ simple_panel(title='Dark Panel', content='

This is a dark panel with darker background.

', variant='dark') }} {{ simple_panel(title='Bordered Panel', content='

This is a bordered panel with no background.

', variant='bordered') }}

Info Panels

{{ info_panel( icon='ℹ️', title='Information', content='This is an informational message.', type='info' ) }} {{ info_panel( icon='✅', title='Success', content='Operation completed successfully!', type='success' ) }} {{ info_panel( icon='⚠️', title='Warning', content='Please review your selections.', type='warning' ) }} {{ info_panel( icon='❌', title='Error', content='An error occurred. Please try again.', type='error', action_text='Retry', action_onclick='alert("Retrying...")' ) }}

Stat Panels

{{ stat_panel('Total Cards', value=100) }} {{ stat_panel('Avg MV', value='3.2', sublabel='Mana Value', variant='primary') }} {{ stat_panel('Lands', value=37, variant='success') }} {{ stat_panel('Budget', value='$125', variant='warning') }}

Collapsible Panel

{% call collapsible_panel(title='Advanced Options', expanded=False) %}

These are advanced settings that are hidden by default.

{% endcall %}

Empty State

{{ empty_state_panel( icon='📋', title='No Decks Found', message='You haven\'t created any decks yet. Start building your first deck!', action_text='Build Deck', action_href='/build' ) }}

Loading State

{{ loading_panel(message='Building deck...', spinner=True) }} {% endcall %}
{{ button('Back to Top', href='#', variant='ghost', onclick='window.scrollTo({top:0,behavior:"smooth"}); return false;') }}
{% endblock %}