-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1014959
commit 5bc1cd4
Showing
20 changed files
with
240 additions
and
42 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
export const timeout = (ms: number) => { | ||
return new Promise((resolve) => setTimeout(resolve, ms)); | ||
}; | ||
|
||
export const promiseFrom = <T>(result: T, time: number = 0): Promise<T> => | ||
new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve(result); | ||
}, time); | ||
}); |
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/web/components/form/dropdown/networkDropdown.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 type { Meta, StoryObj } from 'storybook-solidjs'; | ||
|
||
import { BuilderDtoMeta } from '@contracts/dto/forms/meta/builderDto.meta'; | ||
import { promiseFrom } from '@helpers/asyncHelper'; | ||
import { UseHopeUIThemeProvider, getFormInputArgTypes } from '../../storybook'; | ||
import { FormNetworkDropdown } from './networkDropdown'; | ||
|
||
const meta = { | ||
title: 'Form/NetworkDropdown', | ||
component: FormNetworkDropdown, | ||
decorators: [UseHopeUIThemeProvider], | ||
tags: ['autodocs'], | ||
argTypes: { | ||
...getFormInputArgTypes(), | ||
multiple: { control: 'boolean' }, | ||
}, | ||
} satisfies Meta<typeof FormNetworkDropdown>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Basic: Story = { | ||
args: { | ||
label: 'Name', | ||
placeholder: 'this is a placeholder', | ||
options: ['test1', 'test2', 'test3'].map((t) => ({ title: t, value: t })), | ||
optionsPromise: promiseFrom({ isSuccess: true }, 2000), | ||
validation: BuilderDtoMeta.platforms.validator, | ||
}, | ||
}; |
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
29 changes: 29 additions & 0 deletions
29
src/web/components/form/image/ImageParamsPopover.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,29 @@ | ||
import type { Meta, StoryObj } from 'storybook-solidjs'; | ||
|
||
import { UseHopeUIThemeProvider, getFormInputArgTypes } from '../../storybook'; | ||
import { FormProfileImageInput } from './profileImage'; | ||
import { ImageParamsPopover } from './imageParamsPopover'; | ||
|
||
const meta = { | ||
title: 'Form/ImageParamsPopover', | ||
component: ImageParamsPopover, | ||
decorators: [UseHopeUIThemeProvider], | ||
tags: ['autodocs'], | ||
argTypes: { | ||
imageDetails: { control: 'object' }, | ||
}, | ||
} satisfies Meta<typeof ImageParamsPopover>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Basic: Story = { | ||
args: { | ||
imageDetails: { | ||
width: 4321, | ||
height: 1234, | ||
fileSize: 2000, | ||
fileExtension: 'png', | ||
}, | ||
}, | ||
}; |
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
60 changes: 60 additions & 0 deletions
60
src/web/components/form/mediaUpload/mediaUpload.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,60 @@ | ||
import type { Meta, StoryObj } from 'storybook-solidjs'; | ||
|
||
import { UseHopeUIThemeProvider, getFormInputArgTypes } from '../../storybook'; | ||
import { FormMediaUploadInput } from './mediaUpload'; | ||
import { MediaUploadType } from '@web/contracts/mediaUpload'; | ||
|
||
const meta = { | ||
title: 'Form/FormMediaUploadInput', | ||
component: FormMediaUploadInput, | ||
decorators: [UseHopeUIThemeProvider], | ||
tags: ['autodocs'], | ||
argTypes: { | ||
...getFormInputArgTypes(), | ||
maxUploads: { control: 'number' }, | ||
}, | ||
} satisfies Meta<typeof FormMediaUploadInput>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Basic: Story = { | ||
args: { | ||
label: 'Upload your media', | ||
helpText: 'This is a help icon with a tooltip', | ||
showValidationMessages: true, | ||
}, | ||
}; | ||
|
||
export const NumberOfFilesLimit: Story = { | ||
args: { | ||
label: 'Upload your media', | ||
helpText: 'This is a help icon with a tooltip', | ||
maxUploads: 4, | ||
showValidationMessages: true, | ||
}, | ||
}; | ||
|
||
export const UploadsAdded: Story = { | ||
args: { | ||
label: 'Upload your media', | ||
helpText: 'This is a help icon with a tooltip', | ||
maxUploads: 2, | ||
value: [ | ||
{ | ||
type: MediaUploadType.ImageUrl, | ||
url: 'https://i.imgur.com/aKaOqIh.gif', | ||
}, | ||
], | ||
showValidationMessages: true, | ||
}, | ||
}; | ||
|
||
export const ValidationError: Story = { | ||
args: { | ||
label: 'Upload your media', | ||
helpText: 'This is a help icon with a tooltip', | ||
showValidationMessages: true, | ||
validation: () => ({ isValid: false, errorMessage: 'example error message' }), | ||
}, | ||
}; |
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
48 changes: 48 additions & 0 deletions
48
src/web/components/form/mediaUpload/mediaUploadItem.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,48 @@ | ||
import type { Meta, StoryObj } from 'storybook-solidjs'; | ||
|
||
import { UseHopeUIThemeProvider, getFormInputArgTypes } from '../../storybook'; | ||
import { FormMediaUploadItem } from './mediaUploadItem'; | ||
import { MediaUploadType } from '@web/contracts/mediaUpload'; | ||
|
||
const meta = { | ||
title: 'Form/FormMediaUploadItem', | ||
component: FormMediaUploadItem, | ||
decorators: [UseHopeUIThemeProvider], | ||
tags: ['autodocs'], | ||
argTypes: { | ||
upload: { control: 'object' }, | ||
}, | ||
} satisfies Meta<typeof FormMediaUploadItem>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Basic: Story = { | ||
args: { | ||
upload: { | ||
type: MediaUploadType.File, | ||
file: { | ||
name: 'test.png', | ||
}, | ||
url: 'https://i.imgur.com/aKaOqIh.gif', | ||
}, | ||
}, | ||
}; | ||
|
||
export const ImageUrl: Story = { | ||
args: { | ||
upload: { | ||
type: MediaUploadType.ImageUrl, | ||
url: 'https://i.imgur.com/aKaOqIh.gif', | ||
}, | ||
}, | ||
}; | ||
|
||
export const VideoUrl: Story = { | ||
args: { | ||
upload: { | ||
type: MediaUploadType.VideoUrl, | ||
url: 'https://link.doesnt.matter.com/no-preview-anyway', | ||
}, | ||
}, | ||
}; |
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
Oops, something went wrong.