Skip to content

Commit f8466fb

Browse files
committed
minor #2724 [Toolkit] Minor adjustements on Kit creation command (reword questions, fix doc format) (Kocal)
This PR was merged into the 2.x branch. Discussion ---------- [Toolkit] Minor adjustements on Kit creation command (reword questions, fix doc format) | Q | A | ------------- | --- | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Docs? | no <!-- required for new features --> | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT I've just noticed that the generated document is still using the old format based on Twig and blocks, instead of the new format based on Markdown. Commits ------- 9217bce [Toolkit] Minor adjustements on Kit creation command (reword questions, fix doc format)
2 parents abedbd1 + 9217bce commit f8466fb

File tree

1 file changed

+31
-18
lines changed

1 file changed

+31
-18
lines changed

src/Toolkit/src/Command/CreateKitCommand.php

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
4343
$io = new SymfonyStyle($input, $output);
4444

4545
// Get the kit name
46-
$question = new Question('What is the name of your kit?');
46+
$question = new Question("What's the name of your kit?");
4747
$question->setValidator(function (?string $value) {
4848
if (empty($value)) {
49-
throw new \RuntimeException('Kit name cannot be empty');
49+
throw new \RuntimeException('Kit name cannot be empty.');
5050
}
5151
Assert::kitName($value);
5252

@@ -55,21 +55,21 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5555
$kitName = $io->askQuestion($question);
5656

5757
// Get the kit homepage
58-
$question = new Question('What is the homepage of your kit?');
58+
$question = new Question("What's the Homepage URL of your kit?");
5959
$question->setValidator(function (?string $value) {
6060
if (empty($value) || !filter_var($value, \FILTER_VALIDATE_URL)) {
61-
throw new \Exception('The homepage must be a valid URL');
61+
throw new \Exception('The homepage URL must be valid.');
6262
}
6363

6464
return $value;
6565
});
6666
$kitHomepage = $io->askQuestion($question);
6767

6868
// Get the kit author name
69-
$question = new Question('What is the author name of your kit?');
69+
$question = new Question("What's the name of the author?");
7070
$question->setValidator(function (?string $value) {
7171
if (empty($value)) {
72-
throw new \Exception('The author name cannot be empty');
72+
throw new \Exception('The author name cannot be empty.');
7373
}
7474

7575
return $value;
@@ -80,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8080
$question = new Question('What is the license of your kit?');
8181
$question->setValidator(function (string $value) {
8282
if (empty($value)) {
83-
throw new \Exception('The license cannot be empty');
83+
throw new \Exception('The license cannot be empty.');
8484
}
8585

8686
return $value;
@@ -107,38 +107,51 @@ protected function execute(InputInterface $input, OutputInterface $output): int
107107
) -%}
108108
109109
<button class="{{ style.apply({ variant }, attributes.render('class'))|tailwind_merge }}"
110-
{{ attributes.defaults({}).without('class') }}
110+
{{ attributes }}
111111
>
112112
{%- block content %}{% endblock -%}
113113
</button>
114114
TWIG
115115
);
116-
$this->filesystem->dumpFile('docs/components/Button.twig', <<<TWIG
117-
{% block meta %}
118-
title: Button
119-
description: The Button component is a versatile component that allows you to create clickable buttons with various styles and states.
120-
{% endblock %}
116+
$this->filesystem->dumpFile('docs/components/Button.md', <<<TWIG
117+
# Button
121118
122-
{% block examples %}
123-
# Basic Button
119+
The Button component is a versatile component that allows you to create clickable buttons with various styles and states.
120+
121+
## Installation
122+
123+
Ensure the Symfony UX Toolkit is installed in your Symfony app:
124+
125+
```shell
126+
$ composer require --dev symfony/ux-toolkit
127+
```
128+
129+
Then, run the following command to install the component and its dependencies:
130+
```shell
131+
$ bin/console ux:toolkit:install-component Button --kit github.com/user/my-ux-toolkit-kit
132+
```
133+
134+
## Usage
124135
125136
```twig
126137
<twig:Button>
127138
Click me
128139
</twig:Button>
129140
```
130141
131-
# Button with Variants
142+
## Examples
143+
144+
### Button with Variants
132145
133146
```twig
134147
<twig:Button variant="default">Default</twig:Button>
135148
<twig:Button variant="secondary">Secondary</twig:Button>
136149
```
137-
{% endblock %}
150+
138151
TWIG
139152
);
140153

141-
$io->success('Perfect, you can now start building your kit!');
154+
$io->success('Your kit has been scaffolded, enjoy!');
142155

143156
return self::SUCCESS;
144157
}

0 commit comments

Comments
 (0)