-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(auth): add AccountModal base and login button
- Loading branch information
1 parent
db2db50
commit 92fb23a
Showing
10 changed files
with
107 additions
and
10 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
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
@use '../../styles/variables'; | ||
@use '../../styles/theme'; | ||
|
||
.accountModal { | ||
max-width: 450px; | ||
padding: 24px; | ||
color: theme.$modal-color; | ||
background-color: theme.$modal-bg; | ||
border-radius: 6px; | ||
} | ||
|
||
.banner { | ||
text-align: center; | ||
|
||
> img { | ||
max-width: 50%; | ||
} | ||
} | ||
|
||
.title { | ||
margin-bottom: 24px; | ||
font-family: theme.$body-alt-font-family; | ||
font-weight: 700; | ||
font-size: 24px; | ||
} |
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,12 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
|
||
import AccountModal from './AccountModal'; | ||
|
||
describe('<AccountModal>', () => { | ||
test('renders and matches snapshot', () => { | ||
const { container } = render(<AccountModal />); | ||
|
||
expect(container).toMatchSnapshot(); | ||
}); | ||
}); |
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 React, { useContext } from 'react'; | ||
|
||
import Modal from '../../components/Modal/Modal'; | ||
import { AccountStore } from '../../stores/AccountStore'; | ||
import Button from '../../components/Button/Button'; | ||
import { ConfigContext } from '../../providers/ConfigProvider'; | ||
|
||
import styles from './AccountModal.module.scss'; | ||
|
||
const AccountModal = () => { | ||
const { | ||
assets: { banner }, | ||
} = useContext(ConfigContext); | ||
const { open } = AccountStore.useState((s) => s.modal); | ||
const closeHandler = () => | ||
AccountStore.update((s) => { | ||
s.modal.open = false; | ||
}); | ||
|
||
return ( | ||
<Modal open={open} onClose={closeHandler} className={styles.accountModal} closeButtonVisible> | ||
<div className={styles.banner}>{banner ? <img src={banner} onLoad={() => undefined} alt="" /> : null}</div> | ||
<h2 className={styles.title}>Login!</h2> | ||
<form>form</form> | ||
<Button label="Sign in" variant="contained" color="primary" fullWidth /> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default AccountModal; |
3 changes: 3 additions & 0 deletions
3
src/containers/AccountModal/__snapshots__/AccountModal.test.tsx.snap
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,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<AccountModal> renders and matches snapshot 1`] = `<div />`; |