Skip to content

Commit d964748

Browse files
authored
feat: action mixin (#511)
1 parent e4c6dea commit d964748

File tree

13 files changed

+97
-18
lines changed

13 files changed

+97
-18
lines changed

dist/components/c-card.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/components/cortal-icon.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/components/cortal.icon.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-styles.cms.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-styles.docs.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-styles.portal.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/tools/x-action.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/_imports/components/c-card.css

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@import url("../objects/o-section.selectors.css");
22
@import url("../tools/selectors.css");
33
@import url("../tools/x-link.css");
4-
4+
@import url("../tools/x-action.css");
55
@import url("./c-button.selectors.css");
66
@import url("./c-card.selectors.css");
77

@@ -117,14 +117,6 @@
117117

118118
/* Elements */
119119

120-
:--c-card > a:not(:--c-button),
121-
:--c-card > p > a:not(:--c-button) {
122-
/* XXX: Prevents text around it from wrapping if link spans two lines */
123-
/* FAQ: To fix on client, `class="d-inline"` or `style="display: inline"` */
124-
/* ???: Why does this use `inline-flex`? */
125-
display: inline-flex;
126-
align-items: baseline;
127-
}
128120
/* I.e. one of multiple icon links within a p tag */
129121
:--c-card > p > a:not(:--c-button):has(.icon):not(:last-child) {
130122
margin-right: 1rem;
@@ -135,7 +127,20 @@
135127
margin-bottom: 2rem; /* mimic <p> `margin-bottom` */
136128
margin-right: var(--global-space--pattern-pad);
137129
}
138-
/* So text of card links does not all look link a link */
130+
/* To style actions that have an icon */
131+
:--c-card > a:not(:--c-button):has(.icon),
132+
:--c-card > p > a:not(:--c-button):has(.icon) {
133+
@mixin action--with-icon;
134+
}
135+
:--c-card > a:not(:--c-button) > .icon:last-child,
136+
:--c-card > p > a:not(:--c-button) > .icon:last-child {
137+
@mixin action__icon-at-start;
138+
}
139+
:--c-card > a:not(:--c-button) > .icon:first-child,
140+
:--c-card > p > a:not(:--c-button) > .icon:first-child {
141+
@mixin action__icon-at-end;
142+
}
143+
/* So text of card links does not all look like a link */
139144
a:--c-card {
140145
color: inherit;
141146
text-decoration: none;

src/lib/_imports/components/cortal-icon.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@
5555

5656

5757

58-
/* Cross-Pattern */
58+
/* For "Feed List" with Ideal Markup (f.k.a. Cross-Pattern) */
5959

6060
/* To tweak action icon appearance and layout */
61-
:--c-card > :is(:--action) > .icon:first-child,
6261
p > :is(:--action) > .icon:first-child {
6362
margin-right: 10px;
6463
font-size: 1.2em;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@define-mixin action--with-icon {
2+
display: inline-flex; /* for simple alignment code */
3+
align-items: center;
4+
}
5+
@define-mixin action__icon {
6+
font-size: 1.2em;
7+
}
8+
@define-mixin action__icon-at-start {
9+
margin-inline-end: 0.5em;
10+
}
11+
@define-mixin action__icon-at-end {
12+
margin-inline-start: 0.5em;
13+
}
14+
/* DEMO-USE ONLY */
15+
.x-action--with-icon {
16+
@mixin action--with-icon;
17+
}
18+
.x-action__icon-at-start {
19+
@mixin action__icon;
20+
@mixin action__icon-at-start;
21+
}
22+
.x-action__icon-at-end {
23+
@mixin action__icon;
24+
@mixin action__icon-at-end;
25+
}

0 commit comments

Comments
 (0)