Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(content): support html tables in SContent #565

Merged
merged 3 commits into from
Dec 2, 2024
Merged
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
7 changes: 4 additions & 3 deletions docs/components/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ Place HTML elements inside `<SContent>` component and it will apply basic styles

The supported elements are:

- `<h1>` <Badge text="3.11.0" />
- `<h2>` <Badge text="3.11.0" />
- `<h1>`
- `<h2>`
- `<h3>`
- `<p>`
- `<strong>`
- `<a>`
- `<ul>`
- `<ol>`
- `<li>`
- `<table>`

### Use CSS class to style the headings

Expand Down
37 changes: 37 additions & 0 deletions lib/components/SContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,41 @@
font-feature-settings: "tnum";
content: counter(s-medium-counter)". ";
}

.SContent :deep(table) {
margin: 8px 0;
border-style: hidden;
border-radius: 6px;
text-align: left;
font-size: 14px;
color: var(--c-text-1);
overflow: clip;
box-shadow: 0 0 0 1px var(--c-divider);
}

.SContent :deep(table tr:hover td) {
background-color: var(--c-bg-elv-4);
}

.SContent :deep(table thead > tr > th) {
vertical-align: middle;
}

.SContent :deep(table th),
.SContent :deep(table td) {
border: 1px solid var(--c-gutter);
padding: 8px 16px;
height: 40px;
vertical-align: top;
text-wrap: pretty;
background-color: var(--c-bg-elv-3);
overflow-wrap: break-word;
}

.SContent :deep(table th) {
font-size: 12px;
font-weight: 600;
color: var(--c-text-2);
text-wrap: balance;
}
</style>
27 changes: 27 additions & 0 deletions stories/components/SContent.01_Playground.story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,33 @@ const docs = '/components/content'
<li>Sed ut perspiciatis unde omnis iste natus error.</li>
<li>Lorem ipsum dolor sit amet.</li>
</ol>

<table>
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</td>
<td>Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</td>
<td>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.</td>
</tr>
<tr>
<td>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum.</td>
<td>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui.</td>
<td>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</td>
</tr>
<tr>
<td>Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</td>
<td>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.</td>
<td>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum.</td>
</tr>
</tbody>
</table>
</SContent>
</div>
</Board>
Expand Down