Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 37 additions & 5 deletions app/assets/stylesheets/tailwind/buttons.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,67 @@
@apply inline-flex items-center gap-2 relative;
}

/* Medium (default). Size, radius, icon size and icon-aware padding follow
the Core Design system spec and are identical across all button types. */
.btn {
@apply relative inline-flex items-center text-sm shrink-0 gap-2 justify-center px-4 rounded border border-solid appearance-none whitespace-nowrap cursor-pointer h-[40px];
@apply relative inline-flex items-center text-sm shrink-0 gap-[6px] justify-center px-4 rounded-lg border border-solid appearance-none whitespace-nowrap cursor-pointer h-[40px];
border-color: transparent;
}

/* Icon-aware padding: a leading (left) icon gets less padding on its side than
the text side. Buttons in this system only ever have a left icon or no icon,
so matching the first child is enough — no label wrapper or side class needed. */
.btn:not(.icon-btn):has(> .sn-icon:first-child) {
@apply pl-2;
}

.btn.icon-btn {
@apply px-2 ;
}

.btn.btn-lg {
@apply px-[1.125rem] text-base h-[44px];
@apply px-6 text-base h-[44px] gap-2;
}

.btn.btn-lg:not(.icon-btn):has(> .sn-icon:first-child) {
@apply pl-4;
}


.btn.btn-lg.icon-btn {
@apply px-2.5;
}

.btn.btn-sm {
@apply px-2.5 text-xs h-[36px];
@apply px-3 text-xs h-[36px] gap-1;
}

.btn.btn-sm .sn-icon {
@apply !text-[20px];
}

.btn.btn-sm:not(.icon-btn):has(> .sn-icon:first-child) {
@apply pl-2;
}


.btn.btn-sm.icon-btn {
@apply px-1.5;
@apply px-2;
}

.btn.btn-xs {
@apply px-2.5 text-xs h-[30px];
@apply px-2 text-xs h-[30px] gap-1;
}

.btn.btn-xs .sn-icon {
@apply !text-[16px];
}

.btn.btn-xs:not(.icon-btn):has(> .sn-icon:first-child) {
@apply pl-1.5;
}


.btn.btn-xs.icon-btn {
@apply px-0.5 w-[30px];
}
Expand Down
4 changes: 0 additions & 4 deletions app/views/design_elements/_button.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
<i class="sn-icon sn-icon-<%= icons_list.sample %>"></i>
Button
</button>
<button class="btn <%= type_class %> <%= size_class %>">
Button
<i class="sn-icon sn-icon-<%= icons_list.sample %>"></i>
</button>
<button class="btn <%= type_class %> <%= size_class %>" disabled="true">
Button
</button>
Expand Down