Skip to content

Commit

Permalink
docs: fix spacer table
Browse files Browse the repository at this point in the history
  • Loading branch information
bennypowers committed Oct 13, 2024
1 parent 85e1176 commit 6ef7729
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions docs/assets/javascript/elements/uxdot-spacer-tokens-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ import './uxdot-copy-button.js';

import styles from './uxdot-spacer-tokens-table.css';

const assignBasename = (token: DesignToken) => ({
...token,
baseName: token.name.replace(/^(--)?rh-space-/, ''),
});

/**
* Reads token data from @rhds/tokens and outputs a table for specified tokens
*/
Expand All @@ -35,8 +40,8 @@ export class UxdotSpacerTokensTable extends LitElement {
render() {
const metaData = this.tokens
.map(token => `--rh-space-${token.trim()}`.replace('--rh-space---rh-space-', ''))
.filter(Boolean)
.map(x => metaTokens.get(x as `--rh-${string}`));
.map(x => metaTokens.get(x as `--rh-${string}`))
.filter(Boolean);

// TODO: remove lightdom after implementing auto-load
return html`
Expand All @@ -53,7 +58,7 @@ export class UxdotSpacerTokensTable extends LitElement {
</tr>
</thead>
<tbody>${metaData
.map(token => ({ ...token, baseName: token.name.replace(/^(--)?rh-space-/, '') }))
.map(assignBasename)
.map(token => html`
<tr>
<td data-label="Example">
Expand Down

0 comments on commit 6ef7729

Please sign in to comment.