-
-
Notifications
You must be signed in to change notification settings - Fork 366
[TogglePassword] Add example page for ux.symfony.com #1032
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace App\Form; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\EmailType; | ||
use Symfony\Component\Form\Extension\Core\Type\PasswordType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
|
||
class TogglePasswordForm extends AbstractType | ||
{ | ||
public function buildForm(FormBuilderInterface $builder, array $options): void | ||
{ | ||
$builder | ||
->add('email', EmailType::class) | ||
->add('password', PasswordType::class, [ | ||
'toggle' => true, | ||
]) | ||
; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{% extends 'packageBase.html.twig' %} | ||
|
||
{% block component_header %} | ||
{% component PackageHeader with { | ||
package: 'toggle-password', | ||
eyebrowText: 'Switch between password & text' | ||
} %} | ||
{% block title_header %} | ||
From password to text | ||
<span class="playfair ps-2">& vice versa</span> | ||
{% endblock %} | ||
|
||
{% block sub_content %} | ||
Upgrade your password field to toggle between text and password. | ||
{% endblock %} | ||
{% endcomponent %} | ||
{% endblock %} | ||
|
||
{% block code_block_left %} | ||
<twig:CodeBlock filename="src/Form/TogglePasswordForm.php" /> | ||
{% endblock %} | ||
|
||
{% block code_block_right %} | ||
<twig:CodeBlock | ||
filename="templates/ux_packages/toggle_password.html.twig" | ||
targetTwigBlock="demo_content" | ||
/> | ||
{% endblock %} | ||
|
||
{% block demo_title %}UX Toggle Password{% endblock %} | ||
|
||
{% block demo_content %} | ||
{{ form_start(form) }} | ||
{{ form_row(form.email) }} | ||
{{ form_row(form.password) }} | ||
<button type="submit" class="btn btn-primary">Login</button> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I usually indent the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had a discussion with @HeahDude about this (he shares your opinion) and i agree with both of you, i like the logic 👍🏼 |
||
{{ form_end(form) }} | ||
{% endblock %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too much indentation on these 2 lines