Skip to content

Commit 0dd0d90

Browse files
committed
[Site] Add tags
Only as visual indicators for now (#stepByStep)
1 parent 3c935c4 commit 0dd0d90

File tree

6 files changed

+62
-10
lines changed

6 files changed

+62
-10
lines changed

ux.symfony.com/assets/styles/app.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
@import "components/PackageHeader";
8282
@import "components/PackageBox";
8383
@import "components/Tabs";
84+
@import "components/Tag";
8485
@import "components/Terminal";
8586
@import "components/TerminalCommand";
8687
@import "components/ThemeSwitcher";

ux.symfony.com/assets/styles/components/_DemoCard.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,9 @@
7777
margin: 0;
7878
}
7979
.DemoCard:hover .DemoCard__description {
80-
opacity: .85;
80+
opacity: .85;
81+
}
82+
83+
.DemoCard__tags {
84+
margin-bottom: 0;
8185
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
.Tag {
3+
--background: #E2EAF2;
4+
--color: #191E27;
5+
6+
font-stretch: semi-condensed;
7+
font-weight: 400;
8+
display: inline-flex;
9+
font-size: .65rem;
10+
padding-inline: .4rem;
11+
line-height: 1.4rem;
12+
border-radius: .35rem;
13+
text-transform: uppercase;
14+
vertical-align: middle;
15+
color: var(--color);
16+
background: var(--background);
17+
}
18+
19+
[data-bs-theme="dark"] .Tag {
20+
--background: #191E27;
21+
--color: #A5C4E2;
22+
}

ux.symfony.com/src/Model/LiveDemo.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ public function __construct(
1919
private string $description,
2020
private string $route,
2121
private string $longDescription,
22+
/**
23+
* @var string[]
24+
*/
25+
private array $tags = [],
2226
) {
2327
}
2428

@@ -47,6 +51,11 @@ public function getRoute(): string
4751
return $this->route;
4852
}
4953

54+
public function getTags(): array
55+
{
56+
return $this->tags;
57+
}
58+
5059
public function getScreenshotFilename(): string
5160
{
5261
return 'images/live_demo/'.$this->identifier.'.png';

ux.symfony.com/src/Service/LiveDemoRepository.php

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public function findAll(): array
3232
<br>
3333
This renders a normal Symfony form but with extras added on top,
3434
all generated from Symfony & Twig.
35-
EOF
35+
EOF,
36+
tags: ['form', 'validation', 'inline'],
3637
),
3738
new LiveDemo(
3839
'infinite-scroll',
@@ -43,6 +44,7 @@ public function findAll(): array
4344
Infinite scroll allows users to continuously load content as they scroll down the page.
4445
<br><code>Part One</code> of this demo shows how to <code>append new items</code> to the page with a <a href="/live-component"><code>LiveComponent</code></a>.
4546
EOF,
47+
tags: ['pattern', 'pagination', 'navigation'],
4648
),
4749
new LiveDemo(
4850
'live-memory',
@@ -54,6 +56,7 @@ public function findAll(): array
5456
rich interactions and real-time updates. This journey will take you through many features of Live Components, and you'll
5557
learn how to use them to create a fun and engaging game.
5658
EOF,
59+
tags: ['game', 'time', 'events','LiveAction'],
5760
),
5861
new LiveDemo(
5962
'form-collection-type',
@@ -65,7 +68,8 @@ public function findAll(): array
6568
writing zero JavaScript.
6669
<br>
6770
This demo shows off adding and removing items entirely in PHP & Twig.
68-
EOF
71+
EOF,
72+
tags: ['form', 'collection'],
6973
),
7074
new LiveDemo(
7175
'dependent-form-fields',
@@ -75,7 +79,8 @@ public function findAll(): array
7579
longDescription: <<<EOF
7680
Unleash the power of form events, thanks to <a href="/live-component"><code>LiveComponent</code></a>
7781
and <a href="https://github.com/SymfonyCasts/dynamic-forms"><code>DynamicForms</code></a>.
78-
EOF
82+
EOF,
83+
tags: ['form', 'field', 'events'],
7984
),
8085
new LiveDemo(
8186
'voting',
@@ -86,7 +91,8 @@ public function findAll(): array
8691
With each row as its own component, it's easy to add up & down voting + keep track of which items have been voted on.
8792
<br>
8893
This uses a <a href="https://symfony.com/bundles/ux-live-component/current/index.html#actions">LiveAction</a> to save everything with Ajax.
89-
EOF
94+
EOF,
95+
tags: ['form', 'LiveAction'],
9096
),
9197
new LiveDemo(
9298
'inline-edit',
@@ -96,7 +102,8 @@ public function findAll(): array
96102
longDescription: <<<EOF
97103
Inline editing? Simple. Use LiveComponents to track if you're in "edit" mode, let
98104
the user update any fields on your entity, and save through a <code>LiveAction</code>.
99-
EOF
105+
EOF,
106+
tags: ['form', 'inline', 'LiveAction'],
100107
),
101108
new LiveDemo(
102109
'chartjs',
@@ -107,7 +114,8 @@ public function findAll(): array
107114
What do you get with Live Components + UX Chart.js + UX Autocomplete?
108115
<br>
109116
An auto-updating chart that you will ❤️.
110-
EOF
117+
EOF,
118+
tags: ['chart', 'data', 'LiveAction', 'stimulus'],
111119
),
112120
new LiveDemo(
113121
'invoice',
@@ -118,7 +126,8 @@ public function findAll(): array
118126
Create or edit an `Invoice` entity along with child components for each related `InvoiceItem` entity.
119127
<br>
120128
Children components emit events to communicate to the parent and everything is saved in a `saveInvoice` LiveAction method.
121-
EOF
129+
EOF,
130+
tags: ['form', 'entity', 'events', 'LiveAction'],
122131
),
123132
new LiveDemo(
124133
'product-form',
@@ -127,7 +136,8 @@ public function findAll(): array
127136
route: 'app_demo_live_component_product_form',
128137
longDescription: <<<EOF
129138
Open a child modal component to create a new Category.
130-
EOF
139+
EOF,
140+
tags: ['form', 'entity', 'events', 'modal'],
131141
),
132142
new LiveDemo(
133143
'upload',
@@ -136,7 +146,8 @@ public function findAll(): array
136146
route: 'app_demo_live_component_upload',
137147
longDescription: <<<EOF
138148
File uploads are tricky. Submit them to a `#[LiveAction]` with the `files` modifier on `data-live-action` then process them.
139-
EOF
149+
EOF,
150+
tags: ['form', 'file', 'upload', 'LiveAction'],
140151
),
141152
];
142153
}

ux.symfony.com/templates/components/DemoCard.html.twig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
<p class="DemoCard__description">
1919
{{ demo.description }}
2020
</p>
21+
<p class="DemoCard__tags">
22+
{% for tag in demo.tags %}
23+
<span class="Tag">{{ tag }}</span>
24+
{% endfor %}
25+
</p>
2126
</div>
2227

2328
</article>

0 commit comments

Comments
 (0)