-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(DatasetActionButtons): add stories
- Loading branch information
Showing
11 changed files
with
274 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/stories/dataset/dataset-action-buttons/access-dataset-menu/AccessDatasetMenu.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import { WithI18next } from '../../../WithI18next' | ||
import { WithSettings } from '../../../WithSettings' | ||
import { | ||
DatasetPermissionsMother, | ||
DatasetVersionMother | ||
} from '../../../../../tests/component/dataset/domain/models/DatasetMother' | ||
import { AccessDatasetMenu } from '../../../../sections/dataset/dataset-action-buttons/access-dataset-menu/AccessDatasetMenu' | ||
|
||
const meta: Meta<typeof AccessDatasetMenu> = { | ||
title: 'Sections/Dataset Page/DatasetActionButtons/AccessDatasetMenu', | ||
component: AccessDatasetMenu, | ||
decorators: [WithI18next, WithSettings], | ||
parameters: { | ||
// Sets the delay for all stories. | ||
chromatic: { delay: 15000, pauseAnimationAtEnd: true } | ||
} | ||
} | ||
|
||
export default meta | ||
type Story = StoryObj<typeof AccessDatasetMenu> | ||
|
||
export const WithAllPermissions: Story = { | ||
render: () => ( | ||
<AccessDatasetMenu | ||
version={DatasetVersionMother.createReleased()} | ||
permissions={DatasetPermissionsMother.createWithAllAllowed()} | ||
/> | ||
) | ||
} |
54 changes: 54 additions & 0 deletions
54
src/stories/dataset/dataset-action-buttons/edit-dataset-menu/EditDatasetMenu.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import { WithI18next } from '../../../WithI18next' | ||
import { WithSettings } from '../../../WithSettings' | ||
import { | ||
DatasetMother, | ||
DatasetPermissionsMother | ||
} from '../../../../../tests/component/dataset/domain/models/DatasetMother' | ||
import { EditDatasetMenu } from '../../../../sections/dataset/dataset-action-buttons/edit-dataset-menu/EditDatasetMenu' | ||
|
||
const meta: Meta<typeof EditDatasetMenu> = { | ||
title: 'Sections/Dataset Page/DatasetActionButtons/EditDatasetMenu', | ||
component: EditDatasetMenu, | ||
decorators: [WithI18next, WithSettings], | ||
parameters: { | ||
// Sets the delay for all stories. | ||
chromatic: { delay: 15000, pauseAnimationAtEnd: true } | ||
} | ||
} | ||
|
||
export default meta | ||
type Story = StoryObj<typeof EditDatasetMenu> | ||
|
||
export const WithAllPermissions: Story = { | ||
render: () => ( | ||
<EditDatasetMenu | ||
dataset={DatasetMother.create({ | ||
permissions: DatasetPermissionsMother.createWithAllAllowed(), | ||
hasValidTermsOfAccess: true | ||
})} | ||
/> | ||
) | ||
} | ||
|
||
export const WithManagePermissionsNotAllowed: Story = { | ||
render: () => ( | ||
<EditDatasetMenu | ||
dataset={DatasetMother.create({ | ||
permissions: DatasetPermissionsMother.createWithManagePermissionsNotAllowed(), | ||
hasValidTermsOfAccess: true | ||
})} | ||
/> | ||
) | ||
} | ||
|
||
export const WithNoValidTermsOfAccess: Story = { | ||
render: () => ( | ||
<EditDatasetMenu | ||
dataset={DatasetMother.create({ | ||
permissions: DatasetPermissionsMother.createWithAllAllowed(), | ||
hasValidTermsOfAccess: false | ||
})} | ||
/> | ||
) | ||
} |
22 changes: 22 additions & 0 deletions
22
src/stories/dataset/dataset-action-buttons/link-dataset-button/LinkDatasetButton.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import { WithI18next } from '../../../WithI18next' | ||
import { WithSettings } from '../../../WithSettings' | ||
import { DatasetMother } from '../../../../../tests/component/dataset/domain/models/DatasetMother' | ||
import { LinkDatasetButton } from '../../../../sections/dataset/dataset-action-buttons/link-dataset-button/LinkDatasetButton' | ||
|
||
const meta: Meta<typeof LinkDatasetButton> = { | ||
title: 'Sections/Dataset Page/DatasetActionButtons/LinkDatasetButton', | ||
component: LinkDatasetButton, | ||
decorators: [WithI18next, WithSettings], | ||
parameters: { | ||
// Sets the delay for all stories. | ||
chromatic: { delay: 15000, pauseAnimationAtEnd: true } | ||
} | ||
} | ||
|
||
export default meta | ||
type Story = StoryObj<typeof LinkDatasetButton> | ||
|
||
export const ReleasedDataset: Story = { | ||
render: () => <LinkDatasetButton dataset={DatasetMother.create({ isReleased: true })} /> | ||
} |
64 changes: 64 additions & 0 deletions
64
...tories/dataset/dataset-action-buttons/publish-dataset-menu/PublishDatasetMenu.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import { WithI18next } from '../../../WithI18next' | ||
import { WithSettings } from '../../../WithSettings' | ||
import { | ||
DatasetMother, | ||
DatasetPermissionsMother, | ||
DatasetVersionMother | ||
} from '../../../../../tests/component/dataset/domain/models/DatasetMother' | ||
import { PublishDatasetMenu } from '../../../../sections/dataset/dataset-action-buttons/publish-dataset-menu/PublishDatasetMenu' | ||
|
||
const meta: Meta<typeof PublishDatasetMenu> = { | ||
title: 'Sections/Dataset Page/DatasetActionButtons/PublishDatasetMenu', | ||
component: PublishDatasetMenu, | ||
decorators: [WithI18next, WithSettings], | ||
parameters: { | ||
// Sets the delay for all stories. | ||
chromatic: { delay: 15000, pauseAnimationAtEnd: true } | ||
} | ||
} | ||
|
||
export default meta | ||
type Story = StoryObj<typeof PublishDatasetMenu> | ||
|
||
export const PublishingAllowed: Story = { | ||
render: () => ( | ||
<PublishDatasetMenu | ||
dataset={DatasetMother.create({ | ||
version: DatasetVersionMother.createDraftAsLatestVersion(), | ||
permissions: DatasetPermissionsMother.createWithPublishingDatasetAllowed(), | ||
locks: [], | ||
hasValidTermsOfAccess: true, | ||
isValid: true | ||
})} | ||
/> | ||
) | ||
} | ||
|
||
export const NoValidTermsOfAccess: Story = { | ||
render: () => ( | ||
<PublishDatasetMenu | ||
dataset={DatasetMother.create({ | ||
version: DatasetVersionMother.createDraftAsLatestVersion(), | ||
permissions: DatasetPermissionsMother.createWithPublishingDatasetAllowed(), | ||
locks: [], | ||
hasValidTermsOfAccess: false, | ||
isValid: true | ||
})} | ||
/> | ||
) | ||
} | ||
|
||
export const DatasetInReview: Story = { | ||
render: () => ( | ||
<PublishDatasetMenu | ||
dataset={DatasetMother.create({ | ||
version: DatasetVersionMother.createDraftAsLatestVersionInReview(), | ||
permissions: DatasetPermissionsMother.createWithPublishingDatasetAllowed(), | ||
locks: [], | ||
hasValidTermsOfAccess: true, | ||
isValid: true | ||
})} | ||
/> | ||
) | ||
} |
72 changes: 72 additions & 0 deletions
72
...dataset/dataset-action-buttons/submit-for-review-button/SubmitForReviewButton.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import { WithI18next } from '../../../WithI18next' | ||
import { WithSettings } from '../../../WithSettings' | ||
import { | ||
DatasetLockMother, | ||
DatasetMother, | ||
DatasetPermissionsMother, | ||
DatasetVersionMother | ||
} from '../../../../../tests/component/dataset/domain/models/DatasetMother' | ||
import { SubmitForReviewButton } from '../../../../sections/dataset/dataset-action-buttons/submit-for-review-button/SubmitForReviewButton' | ||
|
||
const meta: Meta<typeof SubmitForReviewButton> = { | ||
title: 'Sections/Dataset Page/DatasetActionButtons/SubmitForReviewButton', | ||
component: SubmitForReviewButton, | ||
decorators: [WithI18next, WithSettings], | ||
parameters: { | ||
// Sets the delay for all stories. | ||
chromatic: { delay: 15000, pauseAnimationAtEnd: true } | ||
} | ||
} | ||
|
||
export default meta | ||
type Story = StoryObj<typeof SubmitForReviewButton> | ||
|
||
export const CanSubmitForReview: Story = { | ||
render: () => ( | ||
<SubmitForReviewButton | ||
dataset={DatasetMother.create({ | ||
version: DatasetVersionMother.createDraftAsLatestVersion(), | ||
permissions: DatasetPermissionsMother.create({ | ||
canUpdateDataset: true, | ||
canPublishDataset: false | ||
}), | ||
locks: [], | ||
hasValidTermsOfAccess: true, | ||
isValid: true | ||
})} | ||
/> | ||
) | ||
} | ||
|
||
export const AlreadySubmittedForReview: Story = { | ||
render: () => ( | ||
<SubmitForReviewButton | ||
dataset={DatasetMother.create({ | ||
version: DatasetVersionMother.createDraftAsLatestVersionInReview(), | ||
permissions: DatasetPermissionsMother.create({ | ||
canUpdateDataset: true, | ||
canPublishDataset: false | ||
}), | ||
locks: [DatasetLockMother.createLockedInReview()] | ||
})} | ||
/> | ||
) | ||
} | ||
|
||
export const NoValidTermsOfAccess: Story = { | ||
render: () => ( | ||
<SubmitForReviewButton | ||
dataset={DatasetMother.create({ | ||
version: DatasetVersionMother.createDraftAsLatestVersion(), | ||
permissions: DatasetPermissionsMother.create({ | ||
canUpdateDataset: true, | ||
canPublishDataset: false | ||
}), | ||
locks: [], | ||
hasValidTermsOfAccess: false, | ||
isValid: true | ||
})} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters