Skip to content

docs(Toolbar): outline part attributes #6816

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

Merged
merged 1 commit into from
Jan 14, 2025
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
70 changes: 38 additions & 32 deletions .storybook/components/DomRefTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,43 @@ function Name(props: CEM.ClassMember) {
);
}

export function ShadowPartsTable({ componentName, cssParts }: { componentName: string; cssParts: CEM.CssPart[] }) {
return (
<>
<Heading>CSS Shadow Parts</Heading>
<p>
<Link target={'_blank'} href={'https://developer.mozilla.org/en-US/docs/Web/CSS/::part'}>
CSS Shadow Parts
</Link>{' '}
allow developers to style elements inside the Shadow DOM.
</p>
<p>
The <code>{componentName}</code> exposes the following CSS Shadow Parts:
</p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{cssParts.map((part) => (
<tr key={part.name}>
<td>
<b>{part.name}</b>
</td>
<td>{part.description}</td>
</tr>
))}
</tbody>
</table>
</>
);
}

ShadowPartsTable.displayName = 'ShadowPartsTable';

export function DomRefTable() {
const docsContext = useContext(DocsContext);
const storyTags: string[] = docsContext.attachedCSFFile?.meta?.tags;
Expand Down Expand Up @@ -146,38 +183,7 @@ export function DomRefTable() {
</>
) : null}

{cssParts.length > 0 ? (
<>
<Heading>CSS Shadow Parts</Heading>
<p>
<Link target={'_blank'} href={'https://developer.mozilla.org/en-US/docs/Web/CSS/::part'}>
CSS Shadow Parts
</Link>{' '}
allow developers to style elements inside the Shadow DOM.
</p>
<p>
The <code>{componentName}</code> exposes the following CSS Shadow Parts:
</p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{cssParts.map((part) => (
<tr key={part.name}>
<td>
<b>{part.name}</b>
</td>
<td>{part.description}</td>
</tr>
))}
</tbody>
</table>
</>
) : null}
{cssParts.length > 0 ? <ShadowPartsTable cssParts={cssParts} /> : null}
</>
);
}
17 changes: 17 additions & 0 deletions packages/main/src/components/Toolbar/Toolbar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
ToolbarSpacer,
ToolbarSeparator
} from '../..';
import { ShadowPartsTable } from '@sb/components/DomRefTable';

<Meta of={ComponentStories} />

Expand Down Expand Up @@ -254,12 +255,28 @@ const ToolbarComponent = () => {

<ArgTypesWithNote of={OverflowToolbarButton} />

<ShadowPartsTable
componentName="OverflowToolbarButton"
cssParts={[
{ name: 'button', description: 'Used to style the native button element' },
{ name: 'icon', description: 'Used to style the ui5-icon element' }
]}
/>

## OverflowToolbarToggleButton

<Description of={OverflowToolbarToggleButton} />

<ArgTypesWithNote of={OverflowToolbarToggleButton} />

<ShadowPartsTable
componentName="OverflowToolbarToggleButton"
cssParts={[
{ name: 'button', description: 'Used to style the native button element' },
{ name: 'icon', description: 'Used to style the ui5-icon element' }
]}
/>

## ToolbarSpacer

<Description of={ToolbarSpacer} />
Expand Down
Loading