-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Refactor RedirectBox to StudioRedirectBox
- Loading branch information
Showing
10 changed files
with
70 additions
and
18 deletions.
There are no files selected for viewing
File renamed without changes.
25 changes: 25 additions & 0 deletions
25
...end/libs/studio-components/src/components/StudioRedirectBox/StudioRedirectBox.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,25 @@ | ||
import React from 'react'; | ||
import type { Meta, StoryFn } from '@storybook/react'; | ||
import { StudioRedirectBox } from './StudioRedirectBox'; | ||
import { StudioParagraph } from '../StudioParagraph'; | ||
|
||
type Story = StoryFn<typeof StudioRedirectBox>; | ||
|
||
const meta: Meta = { | ||
title: 'Components/StudioRedirectBox', | ||
component: StudioRedirectBox, | ||
argTypes: { | ||
title: { | ||
control: 'text', | ||
}, | ||
}, | ||
}; | ||
|
||
export const Preview: Story = (args): React.ReactElement => <StudioRedirectBox {...args} />; | ||
|
||
Preview.args = { | ||
title: 'title', | ||
children: <StudioParagraph size='sm'>Children text</StudioParagraph>, | ||
}; | ||
|
||
export default meta; |
29 changes: 29 additions & 0 deletions
29
frontend/libs/studio-components/src/components/StudioRedirectBox/StudioRedirectBox.test.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 React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { StudioRedirectBox, type StudioRedirectBoxProps } from './StudioRedirectBox'; | ||
import { testRootClassNameAppending } from '../../test-utils/testRootClassNameAppending'; | ||
|
||
const mockTitle: string = 'title'; | ||
|
||
const defaultProps: StudioRedirectBoxProps = { | ||
title: mockTitle, | ||
children: <div />, | ||
}; | ||
|
||
describe('StudioRedirectBox', () => { | ||
it('should render the title and children', () => { | ||
const mockChildrenText: string = 'children'; | ||
renderStudioRedirectBox({ children: <p>{mockChildrenText}</p> }); | ||
|
||
expect(screen.getByText(mockTitle)).toBeInTheDocument(); | ||
expect(screen.getByText(mockChildrenText)).toBeInTheDocument(); | ||
}); | ||
|
||
it('Appends given classname to internal classname', () => { | ||
testRootClassNameAppending((className) => renderStudioRedirectBox({ className })); | ||
}); | ||
}); | ||
|
||
const renderStudioRedirectBox = (props: Partial<StudioRedirectBoxProps> = {}) => { | ||
return render(<StudioRedirectBox {...defaultProps} {...props} />); | ||
}; |
10 changes: 5 additions & 5 deletions
10
...rc/components/RedirectBox/RedirectBox.tsx → ...s/StudioRedirectBox/StudioRedirectBox.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
1 change: 1 addition & 0 deletions
1
frontend/libs/studio-components/src/components/StudioRedirectBox/index.ts
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 @@ | ||
export { StudioRedirectBox } from './StudioRedirectBox'; |
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 was deleted.
Oops, something went wrong.
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