-
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.
Merge pull request #79 from Videodock/feat/my-account-screen
Feat / my account screen
- Loading branch information
Showing
28 changed files
with
825 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@use '../../styles/variables'; | ||
@use '../../styles/theme'; | ||
@use '../../styles/mixins/responsive'; | ||
|
||
.checkbox { | ||
display: flex; | ||
align-items: center; | ||
> input { | ||
margin-right: 10px; | ||
} | ||
} |
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 React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import type { Customer } from 'types/account'; | ||
|
||
import Account from './Account'; | ||
|
||
describe('<Account>', () => { | ||
test('renders and matches snapshot', () => { | ||
const customer: Customer = { | ||
id: '1', | ||
email: '[email protected]', | ||
locale: 'en_en', | ||
country: 'England', | ||
currency: 'Euro', | ||
lastUserIp: 'temp', | ||
}; | ||
const { container } = render(<Account customer={customer} update={(customer) => console.info(customer)} />); | ||
|
||
// todo | ||
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,71 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import type { Customer } from 'types/account'; | ||
|
||
import Button from '../../components/Button/Button'; | ||
|
||
import styles from './Account.module.scss'; | ||
|
||
type Props = { | ||
customer: Customer; | ||
update: (customer: Customer) => void; | ||
panelClassName?: string; | ||
panelHeaderClassName?: string; | ||
}; | ||
|
||
const Account = ({ customer, update, panelClassName, panelHeaderClassName }: Props): JSX.Element => { | ||
const { t } = useTranslation('user'); | ||
|
||
return ( | ||
<> | ||
<div className={panelClassName}> | ||
<div className={panelHeaderClassName}> | ||
<h3>{t('account.email')}</h3> | ||
</div> | ||
<div> | ||
<strong>{t('account.email')}</strong> | ||
<p>{customer.email}</p> | ||
<Button label={t('account.edit_account')} onClick={() => update(customer)} /> | ||
</div> | ||
</div> | ||
<div className={panelClassName}> | ||
<div className={panelHeaderClassName}> | ||
<h3>{t('account.security')}</h3> | ||
</div> | ||
<div> | ||
<strong>{t('account.password')}</strong> | ||
<p>****************</p> | ||
<Button label={t('account.edit_password')} /> | ||
</div> | ||
</div> | ||
<div className={panelClassName}> | ||
<div className={panelHeaderClassName}> | ||
<h3>{t('account.about_you')}</h3> | ||
</div> | ||
<div> | ||
<strong>{t('account.firstname')}</strong> | ||
<p>{customer.firstName}</p> | ||
<strong>{t('account.lastname')}</strong> | ||
<p>{customer.lastName}</p> | ||
<Button label={t('account.edit_information')} /> | ||
</div> | ||
</div> | ||
<div className={panelClassName}> | ||
<div className={panelHeaderClassName}> | ||
<h3>{'Terms & tracking'}</h3> | ||
</div> | ||
<div> | ||
<label className={styles.checkbox}> | ||
<input type="checkbox" id="terms1" name="terms 1" value="Bike" /> | ||
<p> | ||
I accept the <strong>Terms of Conditions</strong> of {'<platform name>'} | ||
</p> | ||
</label> | ||
<Button label={t('account.update_consents')} /> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default Account; |
108 changes: 108 additions & 0 deletions
108
src/components/Account/__snapshots__/Account.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,108 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<Account> renders and matches snapshot 1`] = ` | ||
<div> | ||
<div> | ||
<div> | ||
<h3> | ||
account.email | ||
</h3> | ||
</div> | ||
<div> | ||
<strong> | ||
account.email | ||
</strong> | ||
<p> | ||
[email protected] | ||
</p> | ||
<button | ||
class="button default outlined" | ||
> | ||
<span> | ||
account.edit_account | ||
</span> | ||
</button> | ||
</div> | ||
</div> | ||
<div> | ||
<div> | ||
<h3> | ||
account.security | ||
</h3> | ||
</div> | ||
<div> | ||
<strong> | ||
account.password | ||
</strong> | ||
<p> | ||
**************** | ||
</p> | ||
<button | ||
class="button default outlined" | ||
> | ||
<span> | ||
account.edit_password | ||
</span> | ||
</button> | ||
</div> | ||
</div> | ||
<div> | ||
<div> | ||
<h3> | ||
account.about_you | ||
</h3> | ||
</div> | ||
<div> | ||
<strong> | ||
account.firstname | ||
</strong> | ||
<p /> | ||
<strong> | ||
account.lastname | ||
</strong> | ||
<p /> | ||
<button | ||
class="button default outlined" | ||
> | ||
<span> | ||
account.edit_information | ||
</span> | ||
</button> | ||
</div> | ||
</div> | ||
<div> | ||
<div> | ||
<h3> | ||
Terms & tracking | ||
</h3> | ||
</div> | ||
<div> | ||
<label | ||
class="checkbox" | ||
> | ||
<input | ||
id="terms1" | ||
name="terms 1" | ||
type="checkbox" | ||
value="Bike" | ||
/> | ||
<p> | ||
I accept the | ||
<strong> | ||
Terms of Conditions | ||
</strong> | ||
of | ||
<platform name> | ||
</p> | ||
</label> | ||
<button | ||
class="button default outlined" | ||
> | ||
<span> | ||
account.update_consents | ||
</span> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
`; |
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,38 @@ | ||
@use '../../styles/variables'; | ||
@use '../../styles/theme'; | ||
@use '../../styles/mixins/responsive'; | ||
|
||
.infoBox { | ||
display: flex; | ||
justify-content: space-between; | ||
margin-bottom: variables.$base-spacing; | ||
padding: variables.$base-spacing / 2 variables.$base-spacing; | ||
|
||
font-size: 14px; | ||
line-height: 18px; | ||
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.14), 0 3px 4px rgba(0, 0, 0, 0.12), 0 1px 5px rgba(0, 0, 0, 0.2); | ||
background: rgba(61, 59, 59, 0.08); | ||
border-radius: 4px; | ||
> strong { | ||
line-height: 16px; | ||
letter-spacing: 0.25px; | ||
} | ||
} | ||
|
||
.price { | ||
font-size: 14px; | ||
line-height: 18px; | ||
> strong { | ||
font-weight: bold; | ||
font-size: 24px; | ||
line-height: 26px; | ||
} | ||
} | ||
|
||
.cardDetails { | ||
display: flex; | ||
} | ||
|
||
.expiryDate { | ||
width: 250px; | ||
} |
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,16 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import type { Subscription } from 'types/subscription'; | ||
|
||
import Payment from './Payment'; | ||
|
||
describe('<Payment>', () => { | ||
test('renders and matches snapshot', () => { | ||
const subscription = {} as Subscription; | ||
|
||
const { container } = render(<Payment subscription={subscription} onEditSubscriptionClick={(subscription) => console.info(subscription)} />); | ||
|
||
// todo | ||
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,81 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import type { Subscription } from 'types/subscription'; | ||
|
||
import Button from '../Button/Button'; | ||
|
||
import styles from './Payment.module.scss'; | ||
|
||
type Props = { | ||
subscription: Subscription; | ||
onEditSubscriptionClick: (subscription: Subscription) => void; | ||
panelClassName?: string; | ||
panelHeaderClassName?: string; | ||
}; | ||
|
||
const Payment = ({ subscription, onEditSubscriptionClick, panelClassName, panelHeaderClassName }: Props): JSX.Element => { | ||
const { t } = useTranslation('user'); | ||
const showAllTransactions = () => console.info('show all'); | ||
|
||
return ( | ||
<> | ||
<div className={panelClassName}> | ||
<div className={panelHeaderClassName}> | ||
<h3>{t('payment.subscription_details')}</h3> | ||
</div> | ||
<div className={styles.infoBox}> | ||
<p> | ||
<strong>{t('payment.monthly_subscription')}</strong> <br /> | ||
{t('payment.next_billing_date_on')} | ||
{'<date>'} | ||
</p> | ||
<p className={styles.price}> | ||
<strong>{'€ 14.76'}</strong> | ||
{'/'} | ||
{t('payment.month')} | ||
</p> | ||
</div> | ||
<Button label={t('payment.edit_subscription')} onClick={() => onEditSubscriptionClick} /> | ||
</div> | ||
<div className={panelClassName}> | ||
<div className={panelHeaderClassName}> | ||
<h3>{t('payment.payment_method')}</h3> | ||
</div> | ||
<div> | ||
<strong>{t('payment.card_number')}</strong> | ||
<p>xxxx xxxx xxxx 3456</p> | ||
<div className={styles.cardDetails}> | ||
<div className={styles.expiryDate}> | ||
<strong>{t('payment.expiry_date')}</strong> | ||
<p>{subscription.expiresAt}</p> | ||
</div> | ||
<div> | ||
<strong>{t('payment.cvc_cvv')}</strong> | ||
<p>******</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div className={panelClassName}> | ||
<div className={panelHeaderClassName}> | ||
<h3>{t('payment.transactions')}</h3> | ||
</div> | ||
<div className={styles.infoBox}> | ||
<p> | ||
<strong>{t('payment.monthly_subscription')}</strong> <br /> | ||
{t('payment.price_payed_with_card')} | ||
</p> | ||
<p> | ||
{'<Invoice code>'} | ||
<br /> | ||
{'<Date>'} | ||
</p> | ||
</div> | ||
<p>{t('payment.more_transactions', { amount: 4 })}</p> | ||
<Button label="Show all" onClick={() => showAllTransactions()} /> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default Payment; |
Oops, something went wrong.