Skip to content

[Site] Update demo pages #1215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ux.symfony.com/assets/styles/components/_demo-container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
border-top-right-radius: 12px;
}

.demo-introduction {
a {
color: var(--bs-code-color);
font-weight: 500;
}
code {
font-size: .95em;
}
}

.demo-container-inner {
background-color: var(--bs-secondary-bg);
border: 1px solid var(--bs-secondary-bg-subtle);
Expand Down
5 changes: 5 additions & 0 deletions ux.symfony.com/src/Form/MealPlannerForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ class MealPlannerForm extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
/**
* Install DynamicFormBuilder:.
*
* composer require symfonycasts/dynamic-forms
*/
$builder = new DynamicFormBuilder($builder);

$builder
Expand Down
5 changes: 2 additions & 3 deletions ux.symfony.com/src/Service/LiveDemoRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ public function findAll(): array
description: 'After selecting the first field, automatically reload the options for a second field.',
route: 'app_demo_live_component_dependent_form_fields',
longDescription: <<<EOF
Say goodbye to the hassle of dependent form fields with Live Components.
<br>
Whip up a <a href="https://symfony.com/doc/current/form/dynamic_form_modification.html#form-events-submitted-data">form with dynamic events</a> and then head out for a well-deserved lunch.
Unleash the power of form events, thanks to <a href="/live-component"><code>LiveComponent</code></a>
and <a href="https://github.com/SymfonyCasts/dynamic-forms"><code>DynamicForms</code></a>.
EOF
),
new LiveDemo(
Expand Down
11 changes: 8 additions & 3 deletions ux.symfony.com/src/Util/SourceCleaner.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ class SourceCleaner
{
public static function cleanupPhpFile(string $contents, bool $removeClass = false): string
{
$contents = u($contents)
->replace("<?php\n", '')
->replaceMatches('/namespace[^\n]*/', '');
$contents = u($contents)->replace("<?php\n", '');

// Remove LICENCE header
if ($contents->indexOf('* This file is part of the Symfony package')) {
$contents = $contents->after(' */');
}

$contents = $contents->replaceMatches('/namespace[^\n]*/', '');

if ($removeClass) {
$contents = $contents->replaceMatches('/class[^\n]*\n{/', '')
Expand Down
6 changes: 5 additions & 1 deletion ux.symfony.com/templates/components/CodeBlock.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
{{ stimulus_target('code-expander', 'expandCodeButton') }}
{{ stimulus_action('code-expander', 'expandCode') }}
style="display: none;"
>Expand code</button>
>
<twig:Icon name="arrow-down" />
Expand code
<twig:Icon name="arrow-down" />
</button>
{% endblock %}
</div>
</div>
4 changes: 2 additions & 2 deletions ux.symfony.com/templates/liveDemoBase.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<a href="{{ url('app_demos') }}">DEMO</a>
</p>
<h1 class="ubuntu text-center">{{ demo.name }}</h1>
<div style="font-size: 1rem; line-height: 1.75rem;" class="mt-4">
<div style="font-size: 1rem; line-height: 1.75rem;" class="mt-4 demo-introduction">
{{ demo.longDescription|markdown_to_html }}
</div>
</div>
Expand All @@ -37,7 +37,7 @@
</div>

<div class="container-fluid container-xxl px-4 pt-4 px-md-5 pt-md-5 mb-5">
<div class="mb-3" style="position: relative;">
<div class="mb-5" style="position: relative;">
<div class="p-4 markdown-container bg-body shadow-blur shadow-blur--rainbow" id="demo">
{% block demo_content %}{% endblock %}
</div>
Expand Down