Skip to content

Commit 30a140f

Browse files
committed
minor #2711 [Toolkit] Remove redundant code in Shadcn kit components (Kocal)
This PR was merged into the 2.x branch. Discussion ---------- [Toolkit] Remove redundant code in Shadcn kit components | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Docs? | yes/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 Small PR on the plane ✈️ , by removing redundant and not so much useful code from Toolkit's Shadcn components. Commits ------- f204999 [Toolkit] Remove redundant code in Shadcn kit components
2 parents 06b78be + f204999 commit 30a140f

39 files changed

+39
-39
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<div
1313
class="{{ style.apply({variant}, attributes.render('class'))|tailwind_merge }}"
1414
role="alert"
15-
{{ attributes.defaults({role: 'alert'}).without('class') }}
15+
{{ attributes }}
1616
>
1717
{%- block content %}{% endblock -%}
1818
</div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<p
22
class="{{ 'text-sm [&_p]:leading-relaxed ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</p>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<h5
22
class="{{ 'mb-1 font-medium leading-none tracking-tight ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</h5>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{%- props ratio, style = '' -%}
22
<div
33
style="aspect-ratio: {{ ratio }}; {{ style }}"
4-
{{ attributes.defaults({}).without('style') }}
4+
{{ attributes.without('style') }}
55
>
66
{%- block content %}{% endblock -%}
77
</div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<span
22
class="{{ 'relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</span>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<img
22
class="{{ 'aspect-square h-full w-full ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({alt: ''}).without('class') }}
3+
{{ attributes.defaults({alt: ''}) }}
44
/>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<span
22
class="{{ 'flex h-full w-full items-center justify-center rounded-full bg-muted ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</span>

src/Toolkit/kits/shadcn/templates/components/Badge.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
) -%}
1313
<div
1414
class="{{ style.apply({variant, outline}, attributes.render('class'))|tailwind_merge }}"
15-
{{ attributes.defaults({}).without('class') }}
15+
{{ attributes }}
1616
>
1717
{%- block content %}{% endblock -%}
1818
</div>

src/Toolkit/kits/shadcn/templates/components/Breadcrumb/Ellipsis.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<span
22
class="{{ 'flex h-9 w-9 items-center justify-center ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
role="presentation"
55
aria-hidden="true"
66
>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<li
22
class="{{ 'inline-flex items-center gap-1.5 ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</li>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<a
22
class="{{ 'transition-colors hover:text-foreground ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</a>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<ol
22
class="{{ 'flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5 ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</ol>

src/Toolkit/kits/shadcn/templates/components/Breadcrumb/Page.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<span
22
class="{{ 'font-normal text-foreground ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
role="link"
55
aria-disabled="true"
66
aria-current="page"

src/Toolkit/kits/shadcn/templates/components/Breadcrumb/Separator.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<li
22
class="{{ '[&>svg]:w-3.5 [&>svg]:h-3.5 ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
role="presentation"
55
aria-hidden="true"
66
>

src/Toolkit/kits/shadcn/templates/components/Button.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<{{ as }}
2323
class="{{ style.apply({variant, outline, size}, attributes.render('class'))|tailwind_merge }}"
24-
{{ attributes.defaults({}).without('class') }}
24+
{{ attributes }}
2525
>
2626
{%- block content %}{% endblock -%}
2727
</{{ as }}>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div
22
class="{{ 'rounded-lg border bg-card text-card-foreground shadow-sm ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div
22
class="{{ 'p-6 pt-0 ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div
22
class="{{ 'text-sm text-muted-foreground ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div
22
class="{{ 'flex items-center p-6 pt-0 ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div
22
class="{{ 'flex flex-col space-y-1.5 p-6 ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div
22
class="{{ 'text-2xl font-semibold leading-none tracking-tight ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<input
22
type="checkbox"
33
class="{{ 'peer size-4 inline-block align-middle accent-primary ' ~ attributes.render('class')|tailwind_merge }}"
4-
{{ attributes.defaults({}).without('class') }}
4+
{{ attributes }}
55
>

src/Toolkit/kits/shadcn/templates/components/Input.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
<input
33
type="{{ type }}"
44
class="{{ 'flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ' ~ attributes.render('class')|tailwind_merge }}"
5-
{{ attributes.defaults({}).without('class') }}
5+
{{ attributes }}
66
>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<label
22
class="{{ ('text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 ' ~ attributes.render('class'))|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</label>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<nav
22
class="{{ 'mx-auto flex w-full justify-center ' ~ attributes.render('class')|tailwind_merge }}"
33
role="navigation"
4-
{{ attributes.defaults({}).without('class') }}
4+
{{ attributes }}
55
>
66
{%- block content %}{% endblock -%}
77
</nav>

src/Toolkit/kits/shadcn/templates/components/Progress.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
aria-valuemin="0"
77
aria-valuemax="100"
88
aria-valuenow="{{ value }}"
9-
{{ attributes.defaults({}).without('class') }}
9+
{{ attributes }}
1010
>
1111
<div class="h-full w-full flex-1 bg-primary transition-all" style="transform: translateX(-{{ 100 - value }}%)"></div>
1212
</div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<select
22
class="{{ 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</select>

src/Toolkit/kits/shadcn/templates/components/Separator.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
{{ attributes.defaults({
1414
role: decorative ? 'none' : 'separator',
1515
'aria-orientation': decorative ? false : orientation,
16-
}).without('class') }}
16+
}) }}
1717
>
1818
</div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<div
22
class="{{ 'animate-pulse rounded-full bg-muted ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
></div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<label class="{{ 'relative inline-flex items-center cursor-pointer ' ~ attributes.render('class')|tailwind_merge }}">
2-
<input type="checkbox" class="sr-only peer absolute inset-0 w-full h-full cursor-pointer" {{ attributes.defaults({}).without('class') }}>
2+
<input type="checkbox" class="sr-only peer absolute inset-0 w-full h-full cursor-pointer" {{ attributes }}>
33
<div class="pointer-events-none w-11 h-6 bg-input rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-primary peer-disabled:opacity-50 peer-disabled:cursor-not-allowed"></div>
44
</label>

src/Toolkit/kits/shadcn/templates/components/Table.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="relative w-full overflow-auto">
22
<table
33
class="{{ 'w-full caption-bottom text-sm ' ~ attributes.render('class')|tailwind_merge }}"
4-
{{ attributes.defaults({}).without('class') }}
4+
{{ attributes }}
55
>
66
{%- block content %}{% endblock -%}
77
</table>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<tbody
22
class="{{ '[&_tr:last-child]:border-0 ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</tbody>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<caption
22
class="{{ 'mt-4 text-sm text-muted-foreground ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</caption>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<td
22
class="{{ 'p-4 align-middle [&:has([role=checkbox])]:pr-0 ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</td>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<tfoot
22
class="{{ 'border-t bg-muted/50 font-medium [&>tr]:last:border-b-0 ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</tfoot>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<th
22
class="{{ 'h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</th>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<thead
22
class="{{ '[&_tr]:border-b ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</thead>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<tr
22
class="{{ 'border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
>
55
{%- block content %}{% endblock -%}
66
</tr>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<textarea
22
class="{{ 'flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm ' ~ attributes.render('class')|tailwind_merge }}"
3-
{{ attributes.defaults({}).without('class') }}
3+
{{ attributes }}
44
></textarea>

0 commit comments

Comments
 (0)