Skip to content

Commit 9bc8da7

Browse files
committed
feature #3154 [Toolkit] Add support for documenting props/blocks API (Kocal)
This PR was merged into the 2.x branch. Discussion ---------- [Toolkit] Add support for documenting props/blocks API | Q | A | -------------- | --- | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- if yes, also update UPGRADE-*.md and src/**/CHANGELOG.md --> | Documentation? | no <!-- required for new features, or documentation updates --> | Issues | Fix #2950 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT Props and blocks now render like that: <img width="1130" height="581" alt="image" src="https://github.com/user-attachments/assets/73073232-b030-40de-b332-d4515a34bb09" /> I also updated/fixed some examples or components Commits ------- 133943b [Site] Document Toolkit recipes props and blocks
2 parents 90169b5 + 133943b commit 9bc8da7

File tree

78 files changed

+295
-99
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+295
-99
lines changed

src/Toolkit/kits/shadcn/alert-dialog/templates/components/AlertDialog.html.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{# @prop open boolean Open (or not) the AlertDialog at initial rendering, default to `false` #}
2+
{# @block content The default block #}
13
{%- props open = false, id -%}
24

35
{%- set _alert_dialog_open = open %}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
{% props variant = 'default' %}
1+
{# @prop variant 'default'|'secondary'|'destructive'|'outline'|'ghost'|'link' The variant, default to `default` #}
2+
{# @block content The default block #}
3+
{%- props variant = 'default' -%}
24
<twig:Button variant="{{ variant }}" {{ ...attributes }}>
35
{{- block(outerBlocks.content) -}}
46
</twig:Button>
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
<twig:Button
2-
variant="outline"
3-
data-action="click->alert-dialog#close"
4-
{{ ...attributes }}
5-
>
1+
{# @block content The default block #}
2+
<twig:Button variant="outline" data-action="click->alert-dialog#close" {{ ...attributes }}>
63
{{- block(outerBlocks.content) -}}
74
</twig:Button>

src/Toolkit/kits/shadcn/alert-dialog/templates/components/AlertDialog/Content.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# @block content The default block #}
12
<dialog
23
id="{{ _alert_dialog_id }}"
34
{{ _alert_dialog_open ? 'open' }}

src/Toolkit/kits/shadcn/alert-dialog/templates/components/AlertDialog/Description.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# @block content The default block #}
12
<p
23
id="{{ _alert_dialog_description_id }}"
34
class="{{ 'text-muted-foreground text-sm ' ~ attributes.render('class')|tailwind_merge }}"

src/Toolkit/kits/shadcn/alert-dialog/templates/components/AlertDialog/Footer.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# @block content The default block #}
12
<footer
23
class="{{ 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end ' ~ attributes.render('class')|tailwind_merge }}"
34
{{ attributes }}

src/Toolkit/kits/shadcn/alert-dialog/templates/components/AlertDialog/Header.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# @block content The default block #}
12
<header
23
class="{{ 'flex flex-col gap-2 text-center sm:text-left ' ~ attributes.render('class')|tailwind_merge }}"
34
{{ attributes }}

src/Toolkit/kits/shadcn/alert-dialog/templates/components/AlertDialog/Title.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# @block content The default block #}
12
<h2
23
id="{{ _alert_dialog_title_id }}"
34
class="{{ 'text-lg font-semibold ' ~ attributes.render('class')|tailwind_merge }}"

src/Toolkit/kits/shadcn/alert-dialog/templates/components/AlertDialog/Trigger.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# @block content The default block #}
12
{%- set trigger_attrs = {
23
'data-action': 'click->alert-dialog#open',
34
'data-alert-dialog-target': 'trigger',

src/Toolkit/kits/shadcn/alert/templates/components/Alert.html.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{# @prop variant 'default'|'destructive' The variant, default to `default` #}
2+
{# @block content The default block #}
13
{%- props variant = 'default' -%}
24
{%- set style = html_cva(
35
base: 'relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground',

0 commit comments

Comments
 (0)