|
1 | 1 | ## Twic Doc Bundle |
2 | 2 |
|
3 | | -Allows you to create an overview for your Twig Components, be it either UX-Components, UX-Live-Components or simple snippet templates. |
| 3 | +[](https://qossmic.com) Brought to you by qossmic! |
4 | 4 |
|
5 | | -Components will be grouped in categories and optional sub-categories. |
| 5 | +1. [Installation](#installation) |
| 6 | +2. Configuration |
| 7 | + 1. [Bundle Configuration](docs/BundleConfiguration.md) |
| 8 | + 2. [Component Configuration](docs/ComponentConfiguration.md) |
| 9 | +3. [Routing](#routing) |
| 10 | +4. [Customization](#customizing-the-design) |
| 11 | +5. [Usage](docs/Usage.md) |
| 12 | + |
| 13 | +--- |
6 | 14 |
|
7 | | -The categories must be configured in the bundle-configuration, see below. |
| 15 | +Allows you to create an overview for your Twig Components, be it either [UX-Components](https://symfony.com/bundles/ux-twig-component/current/index.html), [UX-Live-Components](https://symfony.com/bundles/ux-live-component/current/index.html) or simple snippet templates. |
| 16 | + |
| 17 | +Components will be grouped in categories and optional sub-categories. |
8 | 18 |
|
9 | 19 | ### Installation |
10 | 20 |
|
@@ -38,110 +48,8 @@ twig_doc: |
38 | 48 | # or for localized: prefix: /{_locale}/twig/doc/ |
39 | 49 | ``` |
40 | 50 |
|
41 | | -### Template |
42 | | - |
43 | | -To use your design in the documentation, you have to override the component template. |
44 | | - |
45 | | -Create a template in your project: templates/bundles/TwigDocBundle/component.html.twig |
46 | | - |
47 | | -```twig |
48 | | -{% extends '@!TwigDoc/component.html.twig' %} |
49 | | -
|
50 | | -{% block stylesheets %} |
51 | | - <link rel="stylesheet" href="{{ asset('css/your-styles.css') }}"> |
52 | | -{% endblock %} |
53 | | -``` |
54 | | - |
55 | | -#### Customizing the documentation |
56 | | - |
57 | | -If you want to customize the documentation, you can override the template. |
58 | | - |
59 | | -Create a template in your project: templates/bundles/TwigDocBundle/documentation.html.twig |
60 | | - |
61 | | -```twig |
62 | | -{% extends '@!TwigDoc/documentation.html.twig' %} |
63 | | -
|
64 | | -{% block stylesheets %} |
65 | | - <link rel="stylesheet" href="{{ asset('css/your-styles.css') }}"> |
66 | | -{% endblock %} |
67 | | -``` |
68 | | - |
69 | | -### Configuration |
| 51 | +### Customizing the design |
70 | 52 |
|
71 | | -Create a config file: configs/packages/twig_doc.yaml |
| 53 | +To customize the design of the documentation, you can override any template of the bundle in your project. |
72 | 54 |
|
73 | | -#### Configure categories |
74 | | - |
75 | | -```yaml |
76 | | -twig_doc: |
77 | | - categories: |
78 | | - - name: Button |
79 | | - sub_categories: |
80 | | - - Action |
81 | | - - Submit |
82 | | - - name: Heading |
83 | | - - name: Notification |
84 | | - sub_categories: |
85 | | - - Alert |
86 | | - - Flash |
87 | | -#... component config |
88 | | -``` |
89 | | - |
90 | | -#### Example for a Twig UX-Component |
91 | | - |
92 | | -```yaml |
93 | | -twig_doc: |
94 | | - #... categories config |
95 | | - components: |
96 | | - - name: ActionButton # will render %kernel.project_dir%/templates/components/ActionButton.html.twig |
97 | | - title: Action Button |
98 | | - description: An Action button |
99 | | - category: Buttons |
100 | | - sub_category: Action |
101 | | - tags: |
102 | | - - buttons |
103 | | - parameters: |
104 | | - color: String |
105 | | - text: String |
106 | | - link: String |
107 | | - variations: |
108 | | - secondary: |
109 | | - color: secondary |
110 | | - text: Secondary Button |
111 | | - link: '#' |
112 | | - primary: |
113 | | - color: primary |
114 | | - text: Primary Button |
115 | | - link: '#' |
116 | | -``` |
117 | | -The bundle will look for this component in the folder configured for the ux-twig-component bundle (default: %kernel.project_dir%/templates/components/COMPONENT_NAME.html.twig). |
118 | | -
|
119 | | -#### Example for a non ux-twig-component |
120 | | -
|
121 | | -The only difference is that non-ux components use another default-path and the naming is not specified. |
122 | | -
|
123 | | -```yaml |
124 | | -twig_doc: |
125 | | - #... categories config |
126 | | - components: |
127 | | - - name: snippets/alert # will render %kernel.project_dir%/templates/snippets/alert.html.twig |
128 | | - title: Alert |
129 | | - description: non twig-ux-component component |
130 | | - category: Notification |
131 | | - sub_category: |
132 | | - - Alert |
133 | | - tags: |
134 | | - - highlight |
135 | | - - nameIt |
136 | | - parameters: |
137 | | - type: String |
138 | | - msg: String |
139 | | - variations: |
140 | | - primary: |
141 | | - type: primary |
142 | | - msg: Primary Alert |
143 | | - danger: |
144 | | - type: danger |
145 | | - msg: Danger Alert |
146 | | -``` |
147 | | -The bundle will look for this template in the twig template folder (default: %kernel.project_dir%/templates/COMPONENT_NAME.html.twig). |
| 55 | +See: [How to override any Part of a Bundle](https://symfony.com/doc/current/bundles/override.html) |
0 commit comments