Skip to content

Commit

Permalink
🎨 more viewed examples
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnath committed Oct 10, 2023
1 parent 0d8c798 commit e42efb2
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 10 deletions.
26 changes: 22 additions & 4 deletions src/devto/user/user.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ import './index.js';

const stringify = (obj) => JSON.stringify(obj).replace(/"/g, """);

const attrs = (args) => Object.entries(args)
.filter(([key, value]) => value)
.map(([key, value]) => `${key}="${value}"`)
.join(' ');

export default {
title: 'DevTo/devto-user',
component: 'devto-user',
tags: ['autodocs'],
render: (args) => {
const attributes = Object.entries(args)
.filter(([key, value]) => value)
.map(([key, value]) => `${key}="${value}"`)
.join(' ');
const attributes = attrs(args);

return `
<devto-user ${attributes}></devto-user>
Expand Down Expand Up @@ -74,3 +76,19 @@ export const FetchOverides = {
}),
},
}

export const ContainerCheck = {
args: FetchOverides.args,

render: (args) => {
const attributes = attrs(args);

return `
<div style="display: flex; width: 1000px; margin: 1em;">
<devto-user ${attributes} style="flex: 1 1 200px;"></devto-user>
<devto-user ${attributes} style="flex: 1 1 300px;"></devto-user>
<devto-user ${attributes} style="flex: 1 1 400px;"></devto-user>
</div>
`;
}
}
30 changes: 24 additions & 6 deletions src/github/user/user.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ import '.';

const stringify = (obj) => JSON.stringify(obj).replace(/"/g, "&quot;");

const attrs = (args) => Object.entries(args)
.filter(([key, value]) => value)
.map(([key, value]) => `${key}="${value}"`)
.join(' ');

export default {
title: 'GitHub/github-user',
component: 'github-user',
tags: ['autodocs'],
render: (args) => {
const attributes = Object.entries(args)
.filter(([key, value]) => value)
.map(([key, value]) => `${key}="${value}"`)
.join(' ');
const attributes = attrs(args);

return `
<github-user ${attributes}></github-user>
Expand Down Expand Up @@ -120,7 +122,6 @@ export const ReposFetch = {
}
}


export const FetchError = {
args: {
login: 'not-a-real-user',
Expand All @@ -139,4 +140,21 @@ export const FetchError = {
};
await ensureElements(elements, argsAfterFetch);
}
};
};


export const ContainerCheck = {
args: FetchOverides.args,

render: (args) => {
const attributes = attrs(args);

return `
<div style="display: flex; width: 1000px; margin: 1em;">
<github-user ${attributes} style="flex: 1 1 200px;"></github-user>
<github-user ${attributes} style="flex: 1 1 300px;"></github-user>
<github-user ${attributes} style="flex: 1 1 400px;"></github-user>
</div>
`;
}
}

0 comments on commit e42efb2

Please sign in to comment.