Skip to content

Commit

Permalink
Merge branch 'main' into 2048-header-re-animate-and-document-main-slot
Browse files Browse the repository at this point in the history
  • Loading branch information
alizedebray authored Nov 20, 2023
2 parents 5c30ac6 + 82b07cf commit 32d03ad
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 56 deletions.
5 changes: 5 additions & 0 deletions .changeset/clean-files-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-documentation': patch
---

Added attached stories to changelog and search-icons pages to fix "Edit this page on Github" feature.
2 changes: 1 addition & 1 deletion packages/components-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
"eslint": "8.53.0",
"eslint-config-standard-with-typescript": "39.1.1",
"eslint-config-standard-with-typescript": "40.0.0",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-n": "16.3.1",
"eslint-plugin-promise": "6.1.1",
Expand Down
10 changes: 6 additions & 4 deletions packages/documentation/.storybook/blocks/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ function getGitHubUrl(path: String) {
return `${BASEURL}${path.replace(/^\./, '').replace(/\.stories\.ts$/, '.docs.mdx')}`;
}

export default (params: { pathToStoryFile: String }) => (
export default (params: { pathToStoryFile?: String }) => (
<>
<div className="container mt-huge font-size-18 text-end">
<a href={getGitHubUrl(params.pathToStoryFile)} target="_blank" rel="noopener">
Edit this page on GitHub
</a>
{params.pathToStoryFile && (
<a href={getGitHubUrl(params.pathToStoryFile)} target="_blank" rel="noopener">
Edit this page on GitHub
</a>
)}
</div>
<footer className="docs-footer mt-huge bg-light">
<div className="container">
Expand Down
6 changes: 4 additions & 2 deletions packages/documentation/.storybook/blocks/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { PropsWithChildren } from 'react';
import '../styles/layout.scss';
import Footer from './footer';
import Header from './header';
import { ifDefined } from 'lit/directives/if-defined.js';

function shouldShowHeader() {
return new URLSearchParams(window.location.search).get('id') === 'home--docs';
Expand All @@ -18,13 +19,14 @@ export default (props: PropsWithChildren<DocsContainerProps>) => {
context.channel.data.docsPrepared[0].parameters.layout === 'fullscreen'
? 'container-fluid'
: 'container';
const pathToStoryFile = context.storyIdToCSFFile.values().next().value.meta.parameters.fileName;
const pathToStoryFile = context?.storyIdToCSFFile?.values()?.next()?.value?.meta
?.parameters?.fileName;
return (
<DocsContainer context={context}>
<Unstyled>
{shouldShowHeader() && <Header />}
<div className={container}>{children}</div>
{shouldShowFooter() && <Footer pathToStoryFile={pathToStoryFile} />}
{shouldShowFooter() && <Footer pathToStoryFile={ifDefined(pathToStoryFile)} />}
</Unstyled>
</DocsContainer>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ The following examples show the different characteristics of the component. Thes
Wrap a pair of `<input>` and `<label>` elements in a `.form-floating` container to enable floating labels.<br/>
But note that the `<input>` element must come first, so we can ensure the correct styles.

Ensure that `placeholder` attribute is set (even with an empty value) so the label can act as a placeholder when no value is set.

<Canvas of={InputStories.FloatingLabel} />

### Sizing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class Search extends React.Component {
id="IconSearchFilter_Freetext"
type="text"
className="form-control"
placeholder=""
value={this.state.freetext}
onChange={this.searchFreetext.bind(this)}
ref={this.freetextRef}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Meta } from '@storybook/blocks';
import { Search } from './search-icons.blocks';
import * as SearchIcons from './search-icons.stories';

<Meta title="Icons/Search for Icons" />
<Meta of={SearchIcons} />

# Search for icons

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Meta, StoryObj } from '@storybook/web-components';

const meta: Meta = {
title: 'Icons/Search for Icons',
};

export default meta;

type Story = StoryObj;

export const Default: Story = {};
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Markdown, Meta } from '@storybook/blocks';
import changelog from '../../../../../styles/CHANGELOG.md?raw';
import { CodeOrSourceMdx } from '../../utilities/markdown/CodeOrSourceMdx';
import ChangelogStories from './changelog.stories';

<Meta
title="Misc/Changelog"
/>
<Meta of={ChangelogStories}/>

<Markdown options={{ overrides: { code: CodeOrSourceMdx } }}>{changelog}</Markdown>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Meta, StoryObj } from '@storybook/web-components';

const meta: Meta = {
title: 'Misc/Changelog',
};

export default meta;

type Story = StoryObj;

export const Default: Story = {};
69 changes: 24 additions & 45 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 32d03ad

Please sign in to comment.