-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* modal with new header flow + labelled variant + stories * test fixes, a11y props for modal * styles fixes * Revert "styles fixes" This reverts commit 152e937. * style fixes * removed ActionModal component + stories setup for Modal component
- Loading branch information
1 parent
a08b687
commit bff8692
Showing
12 changed files
with
340 additions
and
156 deletions.
There are no files selected for viewing
37 changes: 0 additions & 37 deletions
37
packages/react-components/src/components/Modal/ActionModal.tsx
This file was deleted.
Oops, something went wrong.
107 changes: 67 additions & 40 deletions
107
packages/react-components/src/components/Modal/Modal.module.scss
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
40 changes: 40 additions & 0 deletions
40
packages/react-components/src/components/Modal/Modal.spec.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,40 @@ | ||
import * as React from 'react'; | ||
import userEvent from '@testing-library/user-event'; | ||
import { render, vi } from 'test-utils'; | ||
import { Modal } from './Modal'; | ||
import styles from './Modal.module.scss'; | ||
|
||
const baseClass = 'modal'; | ||
|
||
describe('<Modal /> component', () => { | ||
it('should allow for custom class', () => { | ||
const onClose = vi.fn(); | ||
const { getByRole } = render( | ||
<Modal onClose={onClose} className="my-css-class"> | ||
test | ||
</Modal> | ||
); | ||
expect(getByRole('dialog')).toHaveClass('my-css-class'); | ||
}); | ||
|
||
it('should call onClose method on close modal button press', () => { | ||
const onClose = vi.fn(); | ||
const { getByRole } = render(<Modal onClose={onClose}>test</Modal>); | ||
|
||
userEvent.click(getByRole('button')); | ||
expect(onClose).toBeCalledTimes(1); | ||
}); | ||
|
||
it('should display full space content if prop is given', () => { | ||
const onClose = vi.fn(); | ||
const { getByTestId } = render( | ||
<Modal onClose={onClose} fullSpaceContent> | ||
test | ||
</Modal> | ||
); | ||
|
||
expect(getByTestId('modal-body')).toHaveClass( | ||
styles[`${baseClass}__body--full-space`] | ||
); | ||
}); | ||
}); |
50 changes: 50 additions & 0 deletions
50
packages/react-components/src/components/Modal/Modal.stories.css
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,50 @@ | ||
.heading-wrapper { | ||
display: flex; | ||
justify-content: flex-start; | ||
} | ||
|
||
.heading-icon { | ||
margin-right: 15px; | ||
} | ||
|
||
.heading { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.heading-description { | ||
font-size: 14px; | ||
font-weight: 400; | ||
} | ||
|
||
.full-space-wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
width: 100%; | ||
} | ||
|
||
.full-space-content { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
width: 100%; | ||
text-align: center; | ||
} | ||
|
||
.full-space-header { | ||
margin: 30px 0 15px; | ||
} | ||
|
||
.full-space-text { | ||
max-width: 400px; | ||
} | ||
|
||
.full-space-buttons { | ||
flex-direction: row; | ||
margin: 30px 0; | ||
} | ||
|
||
.full-space-button { | ||
width: 115px; | ||
} |
Oops, something went wrong.