Skip to content

Commit 2110571

Browse files
authored
Merge pull request #853 from ably/WEB-4477_first_last_child_pseudocode
Uses semantic pseudo selectors for spacing collapse
2 parents 6745afe + e190f7c commit 2110571

File tree

3 files changed

+7
-41
lines changed

3 files changed

+7
-41
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ably/ui",
3-
"version": "17.5.6",
3+
"version": "17.5.7",
44
"description": "Home of the Ably design system library ([design.ably.com](https://design.ably.com)). It provides a showcase, development/test environment and a publishing pipeline for different distributables.",
55
"repository": {
66
"type": "git",

src/core/Accordion.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ const AccordionRow = ({
101101
<AccordionTrigger
102102
onClick={onClick}
103103
className={cn({
104-
"flex w-full group/accordion-trigger py-4 ui-text-p1 font-bold text-left items-center gap-3 transition-colors focus:outline-none":
105-
true,
104+
"flex w-full group/accordion-trigger py-4 ui-text-p1 font-bold text-left items-center gap-3 transition-colors focus:outline-none": true,
106105
"px-4 mb-4 rounded-lg": isNonTransparentTheme(theme),
107106
"px-0 rounded-none": !isNonTransparentTheme(theme),
108107
"pointer-events-none focus-visible:outline-none":
@@ -140,8 +139,7 @@ const AccordionRow = ({
140139
{rowInteractive && (
141140
<AccordionContent
142141
className={cn({
143-
"ui-text-p2 overflow-hidden transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down":
144-
true,
142+
"ui-text-p2 overflow-hidden transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down": true,
145143
[options?.contentCSS ?? ""]: options?.contentCSS,
146144
})}
147145
>

src/core/styles.components.css

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -38,51 +38,19 @@
3838
in a way that handles margin collapsing as well (hence not an exact opposite) */
3939
.ui-section-spacing-collapse,
4040
.ui-section-spacing-collapse-full {
41-
@apply -my-4 sm:-my-8 md:-my-16;
41+
@apply -my-4 sm:-my-8 md:-my-16 first:-mb-8 sm:first:-mb-16 md:first:-mb-32 last:-mt-8 sm:last:-mt-16 md:last:-mt-32;
4242
}
4343

4444
.ui-section-spacing-collapse-half {
45-
@apply -my-2 sm:-my-4 md:-my-8;
45+
@apply -my-2 sm:-my-4 md:-my-8 first:-mb-4 sm:first:-mb-8 md:first:-mb-16 last:-mt-4 sm:last:-mt-8 md:last:-mt-16;
4646
}
4747

4848
.ui-section-spacing-collapse-quarter {
49-
@apply -my-1 sm:-my-2 md:-my-4;
49+
@apply -my-1 sm:-my-2 md:-my-4 first:-mb-2 sm:first:-mb-4 md:first:-mb-8 last:-mt-2 sm:last:-mt-4 md:last:-mt-8;
5050
}
5151

5252
.ui-section-spacing-collapse-eighth {
53-
@apply -my-0.5 sm:-my-1 md:-my-2;
54-
}
55-
56-
.ui-section-spacing-collapse-order-first-full {
57-
@apply -mb-8 sm:-mb-16 md:-mb-32;
58-
}
59-
60-
.ui-section-spacing-collapse-order-first-half {
61-
@apply -mb-4 sm:-mb-8 md:-mb-16;
62-
}
63-
64-
.ui-section-spacing-collapse-order-first-quarter {
65-
@apply -mb-2 sm:-mb-4 md:-mb-8;
66-
}
67-
68-
.ui-section-spacing-collapse-order-first-eighth {
69-
@apply -mb-1 sm:-mb-2 md:-mb-4;
70-
}
71-
72-
.ui-section-spacing-collapse-order-last-full {
73-
@apply -mt-8 sm:-mt-16 md:-mt-32;
74-
}
75-
76-
.ui-section-spacing-collapse-order-last-half {
77-
@apply -mt-4 sm:-mt-8 md:-mt-16;
78-
}
79-
80-
.ui-section-spacing-collapse-order-last-quarter {
81-
@apply -mt-2 sm:-mt-4 md:-mt-8;
82-
}
83-
84-
.ui-section-spacing-collapse-order-last-eighth {
85-
@apply -mt-1 sm:-mt-2 md:-mt-4;
53+
@apply -my-0.5 sm:-my-1 md:-my-2 first:-mb-1 sm:first:-mb-2 md:first:-mb-4 last:-mt-1 sm:last:-mt-2 md:last:-mt-4;
8654
}
8755

8856
.ui-content-spacing {

0 commit comments

Comments
 (0)