docs: create stories for new components
I have added atoms, molecules and icons. Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
This commit is contained in:
parent
019c6cf90e
commit
5297ea175f
6 changed files with 498 additions and 0 deletions
34
stories/atoms/CommitBody.stories.ts
Normal file
34
stories/atoms/CommitBody.stories.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
/* Stories for CommitBody atom.
|
||||
* Copyright (C) 2024 André Jaenisch
|
||||
* SPDX-FileCopyrightText: 2024 André Jaenisch
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/svelte';
|
||||
|
||||
import CommitBody from '$lib/components/atoms/CommitBody.svelte';
|
||||
|
||||
const meta = {
|
||||
title: 'Atoms/CommitBody',
|
||||
component: CommitBody,
|
||||
tags: ['autodocs']
|
||||
} satisfies Meta<CommitBody>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Plain: Story = {
|
||||
args: {
|
||||
commit: {
|
||||
hash: 'abc123def456ghi789jkl0',
|
||||
name: 'Added moar tests.',
|
||||
committed: new Date().toISOString()
|
||||
}
|
||||
}
|
||||
};
|
32
stories/atoms/CommitDate.stories.ts
Normal file
32
stories/atoms/CommitDate.stories.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* Stories for CommitDate atom.
|
||||
* Copyright (C) 2024 André Jaenisch
|
||||
* SPDX-FileCopyrightText: 2024 André Jaenisch
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/svelte';
|
||||
|
||||
import CommitDate from '$lib/components/atoms/CommitDate.svelte';
|
||||
|
||||
const meta = {
|
||||
title: 'Atoms/CommitDate',
|
||||
component: CommitDate,
|
||||
tags: ['autodocs']
|
||||
} satisfies Meta<CommitDate>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Plain: Story = {
|
||||
args: {
|
||||
commitDate: new Date().toISOString().slice(0, '1970-01-01'.length),
|
||||
numberOfCommits: 2,
|
||||
repoName: 'Anvil Testing'
|
||||
}
|
||||
};
|
36
stories/icons/Copy16.stories.ts
Normal file
36
stories/icons/Copy16.stories.ts
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2020-present Eric Liu
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*/
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020 - 2024 Eric Liu
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/svelte';
|
||||
import { Copy16 } from 'svelte-octicons';
|
||||
|
||||
const meta = {
|
||||
title: 'Icons/Copy16',
|
||||
component: Copy16,
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
fill: {
|
||||
control: 'color'
|
||||
}
|
||||
}
|
||||
} satisfies Meta<Copy16>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Plain: Story = {};
|
36
stories/icons/FileDirectory16.stories.ts
Normal file
36
stories/icons/FileDirectory16.stories.ts
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2020-present Eric Liu
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*/
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020 - 2024 Eric Liu
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/svelte';
|
||||
import { FileDirectory16 } from 'svelte-octicons';
|
||||
|
||||
const meta = {
|
||||
title: 'Icons/FileDirectory16',
|
||||
component: FileDirectory16,
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
fill: {
|
||||
control: 'color'
|
||||
}
|
||||
}
|
||||
} satisfies Meta<FileDirectory16>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Plain: Story = {};
|
36
stories/icons/GitCommit24.stories.ts
Normal file
36
stories/icons/GitCommit24.stories.ts
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2020-present Eric Liu
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*/
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020 - 2024 Eric Liu
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/svelte';
|
||||
import { GitCommit24 } from 'svelte-octicons';
|
||||
|
||||
const meta = {
|
||||
title: 'Icons/GitCommit24',
|
||||
component: GitCommit24,
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
fill: {
|
||||
control: 'color'
|
||||
}
|
||||
}
|
||||
} satisfies Meta<GitCommit24>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Plain: Story = {};
|
324
stories/molecules/History.stories.ts
Normal file
324
stories/molecules/History.stories.ts
Normal file
|
@ -0,0 +1,324 @@
|
|||
/* Stories for History molecule.
|
||||
* Copyright (C) 2024 André Jaenisch
|
||||
* SPDX-FileCopyrightText: 2024 André Jaenisch
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/svelte';
|
||||
|
||||
import History from '$lib/components/molecules/History.svelte';
|
||||
|
||||
const meta = {
|
||||
title: 'Molecules/History',
|
||||
component: History,
|
||||
tags: ['autodocs']
|
||||
} satisfies Meta<History>;
|
||||
|
||||
const followingsMap = [
|
||||
{
|
||||
'@context': [
|
||||
'https://www.w3.org/ns/activitystreams',
|
||||
'https://w3id.org/security/v2',
|
||||
'https://forgefed.org/ns'
|
||||
],
|
||||
id: 'https://fig.fr33domlover.site/repos/9nOkn',
|
||||
inbox: 'https://fig.fr33domlover.site/repos/9nOkn/inbox',
|
||||
outbox: 'https://fig.fr33domlover.site/repos/9nOkn/outbox',
|
||||
followers: 'https://fig.fr33domlover.site/repos/9nOkn/followers',
|
||||
publicKey: ['https://fig.fr33domlover.site/akey1', 'https://fig.fr33domlover.site/akey2'],
|
||||
type: 'Repository',
|
||||
name: 'Very fun demo',
|
||||
summary: 'Testing MR demo',
|
||||
team: null,
|
||||
versionControlSystem: 'https://forgefed.org/ns#git',
|
||||
sendPatchesTo: 'https://fig.fr33domlover.site/looms/9nOkn',
|
||||
cloneUri: 'https://fig.fr33domlover.site/repos/9nOkn',
|
||||
collaborators: 'https://fig.fr33domlover.site/repos/9nOkn/collabs',
|
||||
context: 'https://fig.fr33domlover.site/repos/9nOkn/projects'
|
||||
},
|
||||
{
|
||||
'@context': [
|
||||
'https://www.w3.org/ns/activitystreams',
|
||||
'https://w3id.org/security/v2',
|
||||
'https://forgefed.org/ns'
|
||||
],
|
||||
id: 'https://fig.fr33domlover.site/repos/Pn9Yn',
|
||||
inbox: 'https://fig.fr33domlover.site/repos/Pn9Yn/inbox',
|
||||
outbox: 'https://fig.fr33domlover.site/repos/Pn9Yn/outbox',
|
||||
followers: 'https://fig.fr33domlover.site/repos/Pn9Yn/followers',
|
||||
publicKey: ['https://fig.fr33domlover.site/akey1', 'https://fig.fr33domlover.site/akey2'],
|
||||
type: 'Repository',
|
||||
name: 'Anvil',
|
||||
summary: 'Mirror of Anvil so I can develop its UI',
|
||||
team: null,
|
||||
versionControlSystem: 'https://forgefed.org/ns#git',
|
||||
cloneUri: 'https://fig.fr33domlover.site/repos/Pn9Yn',
|
||||
collaborators: 'https://fig.fr33domlover.site/repos/Pn9Yn/collabs',
|
||||
context: 'https://fig.fr33domlover.site/repos/Pn9Yn/projects'
|
||||
}
|
||||
];
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Empty: Story = {
|
||||
args: {
|
||||
commitsMap: [],
|
||||
followingsMap: []
|
||||
}
|
||||
};
|
||||
|
||||
export const SingleDateSingleProjectSingleCommit: Story = {
|
||||
args: {
|
||||
commitsMap: generateCommits([
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Initial commit',
|
||||
committed: '2022-09-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
}
|
||||
]),
|
||||
followingsMap
|
||||
}
|
||||
};
|
||||
|
||||
export const SingleDateSingleProjectMultipleCommits: Story = {
|
||||
args: {
|
||||
commitsMap: generateCommits([
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Initial commit',
|
||||
committed: '2022-09-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
},
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Best commit ever',
|
||||
committed: '2022-09-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
}
|
||||
]),
|
||||
followingsMap
|
||||
}
|
||||
};
|
||||
|
||||
export const SingleDateMultipleProjectsSingleCommit: Story = {
|
||||
args: {
|
||||
commitsMap: generateCommits([
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Initial commit',
|
||||
committed: '2022-09-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
},
|
||||
{
|
||||
commitId: 'd6e409a6b536e026c95f64d2732946ba0136ddb1',
|
||||
commitName: 'Best commit ever',
|
||||
committed: '2022-09-28T17:06:36Z',
|
||||
repoId: '9nOkn'
|
||||
}
|
||||
]),
|
||||
followingsMap
|
||||
}
|
||||
};
|
||||
|
||||
export const SingleDateMultipleProjectsMultipleCommits: Story = {
|
||||
args: {
|
||||
commitsMap: generateCommits([
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Initial commit',
|
||||
committed: '2022-09-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
},
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Best commit ever',
|
||||
committed: '2022-09-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
},
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Initial commit',
|
||||
committed: '2022-09-28T17:01:30Z',
|
||||
repoId: '9nOkn'
|
||||
},
|
||||
{
|
||||
commitId: 'd6e409a6b536e026c95f64d2732946ba0136ddb1',
|
||||
commitName: 'Best commit ever',
|
||||
committed: '2022-09-28T17:06:36Z',
|
||||
repoId: '9nOkn'
|
||||
}
|
||||
]),
|
||||
followingsMap
|
||||
}
|
||||
};
|
||||
|
||||
export const MultipleDatesSingleProjectSingleCommit: Story = {
|
||||
args: {
|
||||
commitsMap: generateCommits([
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Initial commit',
|
||||
committed: '2022-09-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
},
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Best commit ever',
|
||||
committed: '2022-10-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
}
|
||||
]),
|
||||
followingsMap
|
||||
}
|
||||
};
|
||||
|
||||
export const MultipleDatesSingleProjectMultipleCommits: Story = {
|
||||
args: {
|
||||
commitsMap: generateCommits([
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Initial commit',
|
||||
committed: '2022-09-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
},
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Best commit ever',
|
||||
committed: '2022-09-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
},
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Initial commit',
|
||||
committed: '2022-10-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
},
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Best commit ever',
|
||||
committed: '2022-10-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
}
|
||||
]),
|
||||
|
||||
followingsMap
|
||||
}
|
||||
};
|
||||
|
||||
export const MultipleDatesMultipleProjectsSingleCommit: Story = {
|
||||
args: {
|
||||
commitsMap: generateCommits([
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Initial commit',
|
||||
committed: '2022-09-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
},
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Initial commit',
|
||||
committed: '2022-10-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
},
|
||||
{
|
||||
commitId: 'd6e409a6b536e026c95f64d2732946ba0136ddb1',
|
||||
commitName: 'Best commit ever',
|
||||
committed: '2022-09-28T17:06:36Z',
|
||||
repoId: '9nOkn'
|
||||
},
|
||||
{
|
||||
commitId: 'd6e409a6b536e026c95f64d2732946ba0136ddb1',
|
||||
commitName: 'Best commit ever',
|
||||
committed: '2022-10-28T17:06:36Z',
|
||||
repoId: '9nOkn'
|
||||
}
|
||||
]),
|
||||
followingsMap
|
||||
}
|
||||
};
|
||||
|
||||
export const MultipleDatesMultipleProjectsMultipleCommits: Story = {
|
||||
args: {
|
||||
commitsMap: generateCommits([
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Initial commit',
|
||||
committed: '2022-09-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
},
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Best commit ever',
|
||||
committed: '2022-09-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
},
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Initial commit',
|
||||
committed: '2022-10-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
},
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Best commit ever',
|
||||
committed: '2022-10-28T17:01:30Z',
|
||||
repoId: 'Pn9Yn'
|
||||
},
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Initial commit',
|
||||
committed: '2022-09-28T17:01:30Z',
|
||||
repoId: '9nOkn'
|
||||
},
|
||||
{
|
||||
commitId: 'd6e409a6b536e026c95f64d2732946ba0136ddb1',
|
||||
commitName: 'Best commit ever',
|
||||
committed: '2022-09-28T17:06:36Z',
|
||||
repoId: '9nOkn'
|
||||
},
|
||||
{
|
||||
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
||||
commitName: 'Initial commit',
|
||||
committed: '2022-10-28T17:01:30Z',
|
||||
repoId: '9nOkn'
|
||||
},
|
||||
{
|
||||
commitId: 'd6e409a6b536e026c95f64d2732946ba0136ddb1',
|
||||
commitName: 'Best commit ever',
|
||||
committed: '2022-10-28T17:06:36Z',
|
||||
repoId: '9nOkn'
|
||||
}
|
||||
]),
|
||||
followingsMap
|
||||
}
|
||||
};
|
||||
|
||||
function generateCommits(metadata) {
|
||||
return metadata.map((metadatum) => {
|
||||
const { repoId, commitId, commitName, committed } = metadatum;
|
||||
|
||||
return {
|
||||
'@context': ['https://www.w3.org/ns/activitystreams', 'https://forgefed.org/ns'],
|
||||
id: `https://fig.fr33domlover.site/repos/${repoId}/commits/${commitId}`,
|
||||
type: 'Commit',
|
||||
context: `https://fig.fr33domlover.site/repos/${repoId}`,
|
||||
attributedTo: 'https://fig.fr33domlover.site/people/qn870',
|
||||
committedBy: {
|
||||
name: 'vervis',
|
||||
mbox: 'mailto:vervis@vervis.vervis'
|
||||
},
|
||||
name: commitName,
|
||||
hash: commitId,
|
||||
created: committed,
|
||||
committed
|
||||
};
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue