@@ -43,10 +43,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
43
43
$ io = new SymfonyStyle ($ input , $ output );
44
44
45
45
// 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? " );
47
47
$ question ->setValidator (function (?string $ value ) {
48
48
if (empty ($ value )) {
49
- throw new \RuntimeException ('Kit name cannot be empty ' );
49
+ throw new \RuntimeException ('Kit name cannot be empty. ' );
50
50
}
51
51
Assert::kitName ($ value );
52
52
@@ -55,21 +55,21 @@ protected function execute(InputInterface $input, OutputInterface $output): int
55
55
$ kitName = $ io ->askQuestion ($ question );
56
56
57
57
// 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? " );
59
59
$ question ->setValidator (function (?string $ value ) {
60
60
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. ' );
62
62
}
63
63
64
64
return $ value ;
65
65
});
66
66
$ kitHomepage = $ io ->askQuestion ($ question );
67
67
68
68
// 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? " );
70
70
$ question ->setValidator (function (?string $ value ) {
71
71
if (empty ($ value )) {
72
- throw new \Exception ('The author name cannot be empty ' );
72
+ throw new \Exception ('The author name cannot be empty. ' );
73
73
}
74
74
75
75
return $ value ;
@@ -80,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
80
80
$ question = new Question ('What is the license of your kit? ' );
81
81
$ question ->setValidator (function (string $ value ) {
82
82
if (empty ($ value )) {
83
- throw new \Exception ('The license cannot be empty ' );
83
+ throw new \Exception ('The license cannot be empty. ' );
84
84
}
85
85
86
86
return $ value ;
@@ -107,38 +107,51 @@ protected function execute(InputInterface $input, OutputInterface $output): int
107
107
) -%}
108
108
109
109
<button class="{{ style.apply({ variant }, attributes.render('class'))|tailwind_merge }}"
110
- {{ attributes.defaults({}).without('class') }}
110
+ {{ attributes }}
111
111
>
112
112
{%- block content %}{% endblock -%}
113
113
</button>
114
114
TWIG
115
115
);
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
121
118
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
124
135
125
136
```twig
126
137
<twig:Button>
127
138
Click me
128
139
</twig:Button>
129
140
```
130
141
131
- # Button with Variants
142
+ ## Examples
143
+
144
+ ### Button with Variants
132
145
133
146
```twig
134
147
<twig:Button variant="default">Default</twig:Button>
135
148
<twig:Button variant="secondary">Secondary</twig:Button>
136
149
```
137
- {% endblock %}
150
+
138
151
TWIG
139
152
);
140
153
141
- $ io ->success ('Perfect, you can now start building your kit ! ' );
154
+ $ io ->success ('Your kit has been scaffolded, enjoy ! ' );
142
155
143
156
return self ::SUCCESS ;
144
157
}
0 commit comments