askrobots / dbbasic-web-native
Public
100+ copy-paste UI components in plain HTML and CSS: no dependencies, no build step.
danq9
Add canonical.html v1.0 - The single source of truth for usability standards
fb6e650
1 year ago
History
semantic-card.html · 8.7 KB · 177 lines
| 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="UTF-8"> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | <title>semantic-card - Semantic Components</title> |
| 7 | <script src="../semantic-components.js"></script> |
| 8 | <link rel="stylesheet" href="component-docs.css"> |
| 9 | </head> |
| 10 | <body> |
| 11 | <div class="container"> |
| 12 | <!-- Header --> |
| 13 | <div class="header"> |
| 14 | <h1 class="component-name"><semantic-card></h1> |
| 15 | <p class="tagline">Inspectable content cards with preview on hover and long-press</p> |
| 16 | <div class="quick-example"> |
| 17 | <semantic-card> |
| 18 | <span slot="media-icon">🚀</span> |
| 19 | <card-title slot="title">Project Alpha</card-title> |
| 20 | <card-description slot="description">Next-gen platform</card-description> |
| 21 | <div slot="preview">Preview content here</div> |
| 22 | </semantic-card> |
| 23 | </div> |
| 24 | </div> |
| 25 | |
| 26 | <!-- Overview --> |
| 27 | <section class="section"> |
| 28 | <h2 class="section-title">Overview</h2> |
| 29 | <p class="section-description">The semantic-card component displays content in a structured format with optional media, title, description, preview content, and actions. It automatically handles hover elevation and preview display.</p> |
| 30 | </section> |
| 31 | |
| 32 | <!-- Examples --> |
| 33 | <section class="section"> |
| 34 | <h2 class="section-title">Examples</h2> |
| 35 | <div class="grid"> |
| 36 | |
| 37 | <div class="example"> |
| 38 | <div class="example-label">Basic Card</div> |
| 39 | <div class="example-demo"> |
| 40 | <semantic-card> |
| 41 | <span slot="media-icon">🚀</span> |
| 42 | <card-title slot="title">Project Alpha</card-title> |
| 43 | <card-description slot="description">Next-gen platform</card-description> |
| 44 | <div slot="preview">Preview content here</div> |
| 45 | </semantic-card> |
| 46 | </div> |
| 47 | <div class="example-code"><semantic-card> |
| 48 | <span slot="media-icon">🚀</span> |
| 49 | <card-title slot="title">Project Alpha</card-title> |
| 50 | <card-description slot="description">Next-gen platform</card-description> |
| 51 | <div slot="preview">Preview content here</div> |
| 52 | </semantic-card></div> |
| 53 | <div class="example-notes">Use for: Content previews, product cards, article teasers<br>Visual: Dark background, hover elevation<br>Interaction: Click to activate, long-press to preview</div> |
| 54 | </div> |
| 55 | </div> |
| 56 | </section> |
| 57 | |
| 58 | <!-- Interactive States --> |
| 59 | <section class="section"> |
| 60 | <h2 class="section-title">Interactive States</h2> |
| 61 | <div class="state-showcase"> |
| 62 | |
| 63 | <div class="state-box"> |
| 64 | <div class="state-label">Default State</div> |
| 65 | <div class="state-visual state-default"> |
| 66 | <semantic-card intent="primary" >Default</semantic-card> |
| 67 | </div> |
| 68 | <div class="state-description">Flat, subtle shadow, grey border</div> |
| 69 | </div> |
| 70 | <div class="state-box"> |
| 71 | <div class="state-label">Hover State</div> |
| 72 | <div class="state-visual state-hover"> |
| 73 | <semantic-card intent="primary" >Hover</semantic-card> |
| 74 | </div> |
| 75 | <div class="state-description">Lifts 4px, blue border glow, preview slides in</div> |
| 76 | </div> |
| 77 | <div class="state-box"> |
| 78 | <div class="state-label">Active State</div> |
| 79 | <div class="state-visual state-active"> |
| 80 | <semantic-card intent="primary" >Active</semantic-card> |
| 81 | </div> |
| 82 | <div class="state-description">Slight scale down on click</div> |
| 83 | </div> |
| 84 | </div> |
| 85 | </section> |
| 86 | |
| 87 | <!-- Properties --> |
| 88 | <section class="section"> |
| 89 | <h2 class="section-title">Properties & Attributes</h2> |
| 90 | <table class="property-table"> |
| 91 | <thead> |
| 92 | <tr> |
| 93 | <th>Attribute</th> |
| 94 | <th>Type</th> |
| 95 | <th>Values</th> |
| 96 | <th>Default</th> |
| 97 | <th>Description</th> |
| 98 | </tr> |
| 99 | </thead> |
| 100 | <tbody> |
| 101 | |
| 102 | <tr style="border-bottom: 1px solid #333;"> |
| 103 | <td style="padding: 12px;"><span class="prop-name">media-url</span></td> |
| 104 | <td style="padding: 12px;"><span class="prop-type">attribute</span></td> |
| 105 | <td style="padding: 12px;"><span class="prop-values">URL</span></td> |
| 106 | <td style="padding: 12px;"></td> |
| 107 | <td style="padding: 12px;">URL for image media</td> |
| 108 | </tr> |
| 109 | <tr style="border-bottom: 1px solid #333;"> |
| 110 | <td style="padding: 12px;"><span class="prop-name">media-alt</span></td> |
| 111 | <td style="padding: 12px;"><span class="prop-type">attribute</span></td> |
| 112 | <td style="padding: 12px;"><span class="prop-values">text</span></td> |
| 113 | <td style="padding: 12px;"></td> |
| 114 | <td style="padding: 12px;">Alt text for image</td> |
| 115 | </tr> |
| 116 | |
| 117 | <tr style="border-bottom: 1px solid #333;"> |
| 118 | <td style="padding: 12px;"><span class="prop-name">media-icon</span></td> |
| 119 | <td style="padding: 12px;"><span class="prop-type">slot</span></td> |
| 120 | <td style="padding: 12px;">Icon/emoji when no image</td> |
| 121 | </tr> |
| 122 | <tr style="border-bottom: 1px solid #333;"> |
| 123 | <td style="padding: 12px;"><span class="prop-name">title</span></td> |
| 124 | <td style="padding: 12px;"><span class="prop-type">slot</span></td> |
| 125 | <td style="padding: 12px;">Card title</td> |
| 126 | </tr> |
| 127 | <tr style="border-bottom: 1px solid #333;"> |
| 128 | <td style="padding: 12px;"><span class="prop-name">description</span></td> |
| 129 | <td style="padding: 12px;"><span class="prop-type">slot</span></td> |
| 130 | <td style="padding: 12px;">Card description/subtitle</td> |
| 131 | </tr> |
| 132 | <tr style="border-bottom: 1px solid #333;"> |
| 133 | <td style="padding: 12px;"><span class="prop-name">preview</span></td> |
| 134 | <td style="padding: 12px;"><span class="prop-type">slot</span></td> |
| 135 | <td style="padding: 12px;">Content shown on hover/long-press</td> |
| 136 | </tr> |
| 137 | <tr style="border-bottom: 1px solid #333;"> |
| 138 | <td style="padding: 12px;"><span class="prop-name">actions</span></td> |
| 139 | <td style="padding: 12px;"><span class="prop-type">slot</span></td> |
| 140 | <td style="padding: 12px;">Action buttons</td> |
| 141 | </tr> |
| 142 | </tbody> |
| 143 | </table> |
| 144 | </section> |
| 145 | |
| 146 | <!-- Events --> |
| 147 | <section class="section"> |
| 148 | <h2 class="section-title">Events</h2> |
| 149 | <table class="property-table"> |
| 150 | <thead> |
| 151 | <tr> |
| 152 | <th>Event</th> |
| 153 | <th>Trigger</th> |
| 154 | <th>Detail</th> |
| 155 | <th>Description</th> |
| 156 | </tr> |
| 157 | </thead> |
| 158 | <tbody> |
| 159 | |
| 160 | <tr style="border-bottom: 1px solid #333;"> |
| 161 | <td style="padding: 12px;"><span class="prop-name">activate</span></td> |
| 162 | <td style="padding: 12px;">Click on card</td> |
| 163 | <td style="padding: 12px;"><code>{ type: "activate" }</code></td> |
| 164 | <td style="padding: 12px;">Card click/tap event</td> |
| 165 | </tr> |
| 166 | <tr style="border-bottom: 1px solid #333;"> |
| 167 | <td style="padding: 12px;"><span class="prop-name">inspect</span></td> |
| 168 | <td style="padding: 12px;">Long-press (500ms)</td> |
| 169 | <td style="padding: 12px;"><code>{ type: "inspect" }</code></td> |
| 170 | <td style="padding: 12px;">Shows preview content</td> |
| 171 | </tr> |
| 172 | </tbody> |
| 173 | </table> |
| 174 | </section> |
| 175 | </div> |
| 176 | </body> |
| 177 | </html> |