|
7 | 7 | <div class="sg-demo-wrapper"> |
8 | 8 | <header class="sg-header"> |
9 | 9 | <h1>Blazor.SimpleGrid Showcase</h1> |
10 | | - <p>Eine leichte Grid-Library für moderne Blazor-Apps.</p> |
| 10 | + <p>A lightweight grid library for modern Blazor apps.</p> |
11 | 11 | </header> |
12 | 12 |
|
13 | 13 | <section class="sg-section"> |
14 | | - <h2>1. Einfaches Spalten-Layout</h2> |
| 14 | + <h2>1. Simple column layout</h2> |
15 | 15 | <div class="sg-preview"> |
16 | | - <SimpleGrid Columns="1fr 1fr 1fr" Gap="15px"> |
17 | | - <SimpleGridItem><div class="sg-box">1</div></SimpleGridItem> |
18 | | - <SimpleGridItem><div class="sg-box">2</div></SimpleGridItem> |
19 | | - <SimpleGridItem><div class="sg-box">3</div></SimpleGridItem> |
| 16 | + <SimpleGrid Columns="1fr 1fr 1fr" Gap="15px" HorizontalItemAlignment="HorizontalItemAlignment.Stretch"> |
| 17 | + <SimpleGridItem class="sg-box">1</SimpleGridItem> |
| 18 | + <SimpleGridItem class="sg-box">2</SimpleGridItem> |
| 19 | + <SimpleGridItem class="sg-box">3</SimpleGridItem> |
20 | 20 | </SimpleGrid> |
21 | 21 | </div> |
22 | 22 | <div class="sg-code"> |
23 | | - <pre><code><SimpleGrid Columns="1fr 1fr 1fr" Gap="15px"> |
| 23 | + <pre><code><SimpleGrid Columns="1fr 1fr 1fr" Gap="15px" HorizontalItemAlignment="HorizontalItemAlignment.Stretch"> |
24 | 24 | <SimpleGridItem>1</SimpleGridItem> |
25 | 25 | <SimpleGridItem>2</SimpleGridItem> |
26 | 26 | <SimpleGridItem>3</SimpleGridItem> |
|
33 | 33 | <div class="sg-preview"> |
34 | 34 | <SimpleGrid Columns="150px 1fr 150px" |
35 | 35 | TemplateAreas="header header header | nav main side | footer footer footer" |
36 | | - Gap="8px"> |
| 36 | + Gap="8px" |
| 37 | + HorizontalItemAlignment="HorizontalItemAlignment.Stretch"> |
37 | 38 |
|
38 | | - <SimpleGridItem Area="header"><div class="sg-box header">Header</div></SimpleGridItem> |
39 | | - <SimpleGridItem Area="nav"><div class="sg-box nav">Nav</div></SimpleGridItem> |
40 | | - <SimpleGridItem Area="main"><div class="sg-box main">Main Content</div></SimpleGridItem> |
41 | | - <SimpleGridItem Area="side"><div class="sg-box side">Side</div></SimpleGridItem> |
42 | | - <SimpleGridItem Area="footer"><div class="sg-box footer">Footer</div></SimpleGridItem> |
| 39 | + <SimpleGridItem class="sg-box header" Area="header">Header</SimpleGridItem> |
| 40 | + <SimpleGridItem class="sg-box nav" Area="nav">Nav</SimpleGridItem> |
| 41 | + <SimpleGridItem class="sg-box main" Area="main">Main Content</SimpleGridItem> |
| 42 | + <SimpleGridItem class="sg-box side" Area="side">Side</SimpleGridItem> |
| 43 | + <SimpleGridItem class="sg-box footer" Area="footer">Footer</SimpleGridItem> |
43 | 44 | </SimpleGrid> |
44 | 45 | </div> |
45 | 46 | <div class="sg-code"> |
46 | 47 | <pre><code><SimpleGrid Columns="150px 1fr 150px" |
47 | 48 | TemplateAreas="header header header | nav main side | footer footer footer" |
48 | | - Gap="8px"> |
| 49 | + Gap="8px" |
| 50 | + HorizontalItemAlignment="HorizontalItemAlignment.Stretch"> |
49 | 51 |
|
50 | | - <SimpleGridItem Area="header"><div class="sg-box header">Header</div></SimpleGridItem> |
51 | | - <SimpleGridItem Area="nav"><div class="sg-box nav">Nav</div></SimpleGridItem> |
52 | | - <SimpleGridItem Area="main"><div class="sg-box main">Main Content</div></SimpleGridItem> |
53 | | - <SimpleGridItem Area="side"><div class="sg-box side">Side</div></SimpleGridItem> |
54 | | - <SimpleGridItem Area="footer"><div class="sg-box footer">Footer</div></SimpleGridItem> |
| 52 | + <SimpleGridItem Area="header">Header</SimpleGridItem> |
| 53 | + <SimpleGridItem Area="nav">Nav</SimpleGridItem> |
| 54 | + <SimpleGridItem Area="main">Main Content</SimpleGridItem> |
| 55 | + <SimpleGridItem Area="side">Side</SimpleGridItem> |
| 56 | + <SimpleGridItem Area="footer">Footer</SimpleGridItem> |
55 | 57 | </SimpleGrid></code></pre> |
56 | 58 | </div> |
57 | 59 | </section> |
58 | 60 | <section class="sg-section"> |
59 | 61 | <h2>3. Responsive Grid (Auto-Resize)</h2> |
60 | 62 | <p style="font-size: 0.9rem; color: #666; margin-bottom: 1rem;"> |
61 | | - Verkleinere das Browserfenster, um zu sehen, wie die Spalten automatisch umbrechen. |
| 63 | + Minimize the browser window to see how the columns wrap automatically. |
62 | 64 | </p> |
63 | 65 | <div class="sg-preview"> |
64 | | - <SimpleGrid Columns="repeat(auto-fill, minmax(200px, 1fr))" Gap="15px"> |
65 | | - <SimpleGridItem><div class="sg-box">Card 1</div></SimpleGridItem> |
66 | | - <SimpleGridItem><div class="sg-box">Card 2</div></SimpleGridItem> |
67 | | - <SimpleGridItem><div class="sg-box">Card 3</div></SimpleGridItem> |
68 | | - <SimpleGridItem><div class="sg-box">Card 4</div></SimpleGridItem> |
| 66 | + <SimpleGrid Columns="repeat(auto-fill, minmax(200px, 1fr))" Gap="15px" |
| 67 | + HorizontalItemAlignment="HorizontalItemAlignment.Stretch"> |
| 68 | + <SimpleGridItem class="sg-box">Card 1</SimpleGridItem> |
| 69 | + <SimpleGridItem class="sg-box">Card 2</SimpleGridItem> |
| 70 | + <SimpleGridItem class="sg-box">Card 3</SimpleGridItem> |
| 71 | + <SimpleGridItem class="sg-box">Card 4</SimpleGridItem> |
69 | 72 | </SimpleGrid> |
70 | 73 | </div> |
71 | 74 | <div class="sg-code"> |
72 | | - <pre><code><!-- Die Spalten passen sich automatisch der Container-Breite an --> |
73 | | -<SimpleGrid Columns="repeat(auto-fill, minmax(200px, 1fr))" Gap="15px"> |
74 | | - <SimpleGridItem><div class="sg-box">Card 1</div></SimpleGridItem> |
75 | | - <SimpleGridItem><div class="sg-box">Card 2</div></SimpleGridItem> |
76 | | - <SimpleGridItem><div class="sg-box">Card 3</div></SimpleGridItem> |
77 | | - <SimpleGridItem><div class="sg-box">Card 4</div></SimpleGridItem> |
| 75 | + <pre><code><SimpleGrid Columns="repeat(auto-fill, minmax(200px, 1fr))" Gap="15px" HorizontalItemAlignment="HorizontalItemAlignment.Stretch"> |
| 76 | + <SimpleGridItem>Card 1</SimpleGridItem> |
| 77 | + <SimpleGridItem>Card 2</SimpleGridItem> |
| 78 | + <SimpleGridItem>Card 3</SimpleGridItem> |
| 79 | + <SimpleGridItem>Card 4</SimpleGridItem> |
78 | 80 | </SimpleGrid></code></pre> |
79 | 81 | </div> |
80 | 82 | </section> |
| 83 | + <section class="sg-section"> |
| 84 | + <h2>4. Explicit Rows & Width (Dashboard Style)</h2> |
| 85 | + <p class="sg-description">Using explicit <code>Rows</code> and <code>Width="100%"</code> to create a fixed-height layout.</p> |
| 86 | + <div class="sg-preview"> |
| 87 | + <SimpleGrid Columns="1fr 1fr" Rows="50px 150px" Width="100%" Gap="10px" HorizontalItemAlignment="HorizontalItemAlignment.Stretch"> |
| 88 | + <SimpleGridItem class="sg-box header" ColumnSpan="2">Top Bar (50px)</SimpleGridItem> |
| 89 | + <SimpleGridItem class="sg-box main">Widget A (150px)</SimpleGridItem> |
| 90 | + <SimpleGridItem class="sg-box main">Widget B (150px)</SimpleGridItem> |
| 91 | + </SimpleGrid> |
| 92 | + </div> |
| 93 | + <div class="sg-code"> |
| 94 | + <pre><code><SimpleGrid Columns="1fr 1fr" Rows="50px 150px" Width="100%" Gap="10px" HorizontalItemAlignment="HorizontalItemAlignment.Stretch"> |
| 95 | + <SimpleGridItem ColumnSpan="2">Top Bar (50px)</SimpleGridItem> |
| 96 | + <SimpleGridItem>Widget A (150px)</SimpleGridItem> |
| 97 | + <SimpleGridItem>Widget B (150px)</SimpleGridItem> |
| 98 | +</SimpleGrid></code></pre> |
| 99 | + </div> |
| 100 | + </section> |
| 101 | + |
| 102 | + @* --- NEU: Sektion 5: Alignment & Overrides --- *@ |
| 103 | + <section class="sg-section"> |
| 104 | + <h2>5. Alignment & Item Overrides</h2> |
| 105 | + <p class="sg-description">The grid centers all items, but the second item overrides this to <code>End</code>.</p> |
| 106 | + <div class="sg-preview"> |
| 107 | + <SimpleGrid Columns="1fr 1fr" Height="150px" |
| 108 | + HorizontalItemAlignment="HorizontalItemAlignment.Center" |
| 109 | + VerticalItemAlignment="VerticalItemAlignment.Center" |
| 110 | + Style="background: #eee;"> |
| 111 | + |
| 112 | + <SimpleGridItem class="sg-box"> |
| 113 | + Centered |
| 114 | + </SimpleGridItem> |
81 | 115 |
|
| 116 | + <SimpleGridItem class="sg-box" HorizontalAlignment="HorizontalItemAlignment.End" VerticalAlignment="VerticalItemAlignment.End"> |
| 117 | + I'm at the Bottom |
| 118 | + </SimpleGridItem> |
| 119 | + </SimpleGrid> |
| 120 | + </div> |
| 121 | + <div class="sg-code"> |
| 122 | + <pre><code><SimpleGrid Columns="1fr 1fr" Height="150px" |
| 123 | + HorizontalItemAlignment="HorizontalItemAlignment.Center" |
| 124 | + VerticalItemAlignment="VerticalItemAlignment.Center"> |
| 125 | + |
| 126 | + <SimpleGridItem>Centered Item</SimpleGridItem> |
| 127 | + |
| 128 | + <SimpleGridItem VerticalAlignment="VerticalItemAlignment.End"> |
| 129 | + Bottom Override |
| 130 | + </SimpleGridItem> |
| 131 | +</SimpleGrid></code></pre> |
| 132 | + </div> |
| 133 | + </section> |
| 134 | + |
| 135 | + <section class="sg-section"> |
| 136 | + <h2>6. Global Options (DI)</h2> |
| 137 | + <p class="sg-description">You can configure these defaults in your <code>Program.cs</code>.</p> |
| 138 | + <div class="sg-code"> |
| 139 | + <pre><code>builder.Services.AddSimpleGrid(options => { |
| 140 | + options.HorizontalGap = "2rem"; |
| 141 | + options.ItemVerticalAlignment = VerticalItemAlignment.Center; |
| 142 | +});</code></pre> |
| 143 | + </div> |
| 144 | + </section> |
82 | 145 | </div> |
83 | 146 |
|
84 | 147 | <style> |
|
0 commit comments