Skip to content

Commit 93a3e26

Browse files
committed
Add support for tables to the AuContent component
The styles are based on the `AuTable` component with some small modifications since we can't depend on the table wrapper element.
1 parent 5338af6 commit 93a3e26

File tree

1 file changed

+99
-1
lines changed

1 file changed

+99
-1
lines changed

styles/components/_c-content.scss

+99-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ $au-content-tiny: var(--au-small) !default;
2424
/* Component
2525
========================================================================== */
2626

27-
// @TODO: add base styling for common elements (tables, hr, blockquote, ...)
27+
// @TODO: add base styling for common elements (hr, blockquote, ...)
2828
.au-c-content {
2929
@include au-font-size($au-content-base-small);
3030
color: var(--au-gray-900);
@@ -125,6 +125,104 @@ $au-content-tiny: var(--au-small) !default;
125125
color: var(--au-gray-700);
126126
}
127127

128+
// Table styles are based on the <AuTable> component styles
129+
table:not(.au-c-table) {
130+
@include au-font-size(var(--au-h6));
131+
display: table;
132+
position: relative;
133+
width: 100%;
134+
border-collapse: collapse;
135+
outline: 0.1rem solid var(--au-gray-300); // border doesn't have the intended effect
136+
137+
thead {
138+
position: relative;
139+
width: 100%;
140+
z-index: var(--au-z-index-alpha);
141+
border: 0;
142+
@include au-font-size(var(--au-base), 1.2);
143+
}
144+
145+
th,
146+
td {
147+
max-width: 55ch;
148+
position: relative;
149+
text-align: start;
150+
}
151+
152+
th + th,
153+
th + td,
154+
td + th,
155+
td + td {
156+
&:after {
157+
content: "";
158+
display: block;
159+
position: absolute;
160+
width: 0.1rem;
161+
left: -0.1rem;
162+
top: 0;
163+
height: 100%;
164+
border-left: 0.1rem dotted var(--au-gray-300);
165+
}
166+
}
167+
}
168+
169+
thead:not(.au-c-table__header) {
170+
background-color: var(--au-white);
171+
172+
th {
173+
font-weight: var(--au-medium);
174+
text-align: left;
175+
white-space: nowrap;
176+
padding: $au-unit-small;
177+
border-radius: 0;
178+
border: 0;
179+
outline: 0;
180+
background-color: var(--au-white);
181+
box-shadow: inset 0 -0.2rem 0 0 var(--au-gray-300);
182+
}
183+
}
184+
185+
tbody:not(.au-c-table__body) {
186+
tr {
187+
border-bottom: 0.1rem solid var(--au-gray-300);
188+
background-color: var(--au-white);
189+
}
190+
191+
td,
192+
th {
193+
padding: $au-unit-small;
194+
}
195+
}
196+
197+
tfoot:not(.au-c-table__footer) {
198+
tr + tr {
199+
border-top: 0.1rem solid var(--au-gray-300);
200+
}
201+
202+
tr:first-child {
203+
border-top: 0.2rem solid var(--au-gray-300);
204+
}
205+
206+
tr {
207+
background-color: var(--au-white);
208+
}
209+
210+
td,
211+
th {
212+
@include au-font-size(var(--au-base));
213+
padding: $au-unit-tiny $au-unit-small;
214+
}
215+
}
216+
217+
caption:not(.au-c-table__caption) {
218+
@include au-font-size(var(--au-h5));
219+
font-weight: var(--au-medium);
220+
text-align: left;
221+
padding: $au-unit-tiny $au-unit-small;
222+
background-color: var(--au-gray-100);
223+
border-bottom: 0.1rem solid var(--au-gray-300);
224+
}
225+
128226
@include mq(small) {
129227
h1,
130228
.au-c-heading--1 {

0 commit comments

Comments
 (0)