generated from openedx/frontend-template-application
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
15 changed files
with
379 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@import "@edx/brand/paragon/fonts.scss"; | ||
@import "@edx/brand/paragon/variables.scss"; | ||
@import "@openedx/paragon/scss/core/core.scss"; | ||
@import "@edx/brand/paragon/overrides.scss"; | ||
@import "~@edx/brand/paragon/fonts"; | ||
@import "~@edx/brand/paragon/variables"; | ||
@import "~@openedx/paragon/scss/core/core"; | ||
@import "~@edx/brand/paragon/overrides"; |
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,44 @@ | ||
import PropTypes from 'prop-types'; | ||
|
||
import { | ||
Button, | ||
} from '@openedx/paragon'; | ||
import { Add } from '@openedx/paragon/icons'; | ||
import { useIntl } from '@edx/frontend-platform/i18n'; | ||
|
||
import messages from '../messages'; | ||
import './AllowanceList.scss'; | ||
|
||
const AllowanceList = ({ allowances }) => { | ||
const { formatMessage } = useIntl(); | ||
|
||
return ( | ||
<> | ||
<div className="allowances-header"> | ||
<h3 data-testid="allowances"> {formatMessage(messages.allowanceDashboardTabTitle)} </h3> | ||
<Button variant="outline-primary" iconBefore={Add} size="sm" className="header-allowance-button"> | ||
{formatMessage(messages.allowanceButton)} | ||
</Button> | ||
</div> | ||
<div className="allowances-body"> | ||
{ allowances.length === 0 | ||
? ( | ||
<> | ||
<h4> {formatMessage(messages.noAllowancesHeader)} </h4> | ||
<p> {formatMessage(messages.noAllowancesBody)} </p> | ||
<Button variant="primary" iconBefore={Add}> | ||
{formatMessage(messages.allowanceButton)} | ||
</Button> | ||
</> | ||
) | ||
: null } | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
AllowanceList.propTypes = { | ||
allowances: PropTypes.arrayOf(PropTypes.object).isRequired, // eslint-disable-line react/forbid-prop-types | ||
}; | ||
|
||
export default AllowanceList; |
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,18 @@ | ||
.allowances-body { | ||
display: inline-block; | ||
text-align: center; | ||
width: 100%; | ||
padding-bottom: 50px; | ||
} | ||
|
||
.allowances-header { | ||
width: 100%; | ||
padding: 10px; | ||
position: relative; | ||
|
||
.header-allowance-button { | ||
position: absolute; | ||
top: 10px; | ||
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,12 @@ | ||
import { render } from '@testing-library/react'; | ||
|
||
import AllowanceList from './AllowanceList'; | ||
|
||
// normally mocked for unit tests but required for rendering/snapshots | ||
// jest.unmock('react'); | ||
|
||
describe('AllowanceList', () => { | ||
it('Test that the AllowanceList matches snapshot', () => { | ||
expect(render(<AllowanceList allowances={[]} />)).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
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
214 changes: 214 additions & 0 deletions
214
src/pages/ExamsPage/components/__snapshots__/AllowanceList.test.jsx.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,214 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AllowanceList Test that the AllowanceList matches snapshot 1`] = ` | ||
{ | ||
"asFragment": [Function], | ||
"baseElement": <body> | ||
<div> | ||
<div | ||
class="allowances-header" | ||
> | ||
<h3 | ||
data-testid="allowances" | ||
> | ||
Allowances | ||
</h3> | ||
<button | ||
class="header-allowance-button btn btn-outline-primary btn-sm" | ||
type="button" | ||
> | ||
<span | ||
class="pgn__icon pgn__icon__sm btn-icon-before" | ||
> | ||
<svg | ||
aria-hidden="true" | ||
fill="none" | ||
focusable="false" | ||
height="24" | ||
role="img" | ||
viewBox="0 0 24 24" | ||
width="24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
</span> | ||
Add allowance | ||
</button> | ||
</div> | ||
<div | ||
class="allowances-body" | ||
> | ||
<h4> | ||
No Allowances | ||
</h4> | ||
<p> | ||
Need to grant an allowance? Get started here. | ||
</p> | ||
<button | ||
class="btn btn-primary" | ||
type="button" | ||
> | ||
<span | ||
class="pgn__icon btn-icon-before" | ||
> | ||
<svg | ||
aria-hidden="true" | ||
fill="none" | ||
focusable="false" | ||
height="24" | ||
role="img" | ||
viewBox="0 0 24 24" | ||
width="24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
</span> | ||
Add allowance | ||
</button> | ||
</div> | ||
</div> | ||
</body>, | ||
"container": <div> | ||
<div | ||
class="allowances-header" | ||
> | ||
<h3 | ||
data-testid="allowances" | ||
> | ||
Allowances | ||
</h3> | ||
<button | ||
class="header-allowance-button btn btn-outline-primary btn-sm" | ||
type="button" | ||
> | ||
<span | ||
class="pgn__icon pgn__icon__sm btn-icon-before" | ||
> | ||
<svg | ||
aria-hidden="true" | ||
fill="none" | ||
focusable="false" | ||
height="24" | ||
role="img" | ||
viewBox="0 0 24 24" | ||
width="24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
</span> | ||
Add allowance | ||
</button> | ||
</div> | ||
<div | ||
class="allowances-body" | ||
> | ||
<h4> | ||
No Allowances | ||
</h4> | ||
<p> | ||
Need to grant an allowance? Get started here. | ||
</p> | ||
<button | ||
class="btn btn-primary" | ||
type="button" | ||
> | ||
<span | ||
class="pgn__icon btn-icon-before" | ||
> | ||
<svg | ||
aria-hidden="true" | ||
fill="none" | ||
focusable="false" | ||
height="24" | ||
role="img" | ||
viewBox="0 0 24 24" | ||
width="24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
</span> | ||
Add allowance | ||
</button> | ||
</div> | ||
</div>, | ||
"debug": [Function], | ||
"findAllByAltText": [Function], | ||
"findAllByDisplayValue": [Function], | ||
"findAllByLabelText": [Function], | ||
"findAllByPlaceholderText": [Function], | ||
"findAllByRole": [Function], | ||
"findAllByTestId": [Function], | ||
"findAllByText": [Function], | ||
"findAllByTitle": [Function], | ||
"findByAltText": [Function], | ||
"findByDisplayValue": [Function], | ||
"findByLabelText": [Function], | ||
"findByPlaceholderText": [Function], | ||
"findByRole": [Function], | ||
"findByTestId": [Function], | ||
"findByText": [Function], | ||
"findByTitle": [Function], | ||
"getAllByAltText": [Function], | ||
"getAllByDisplayValue": [Function], | ||
"getAllByLabelText": [Function], | ||
"getAllByPlaceholderText": [Function], | ||
"getAllByRole": [Function], | ||
"getAllByTestId": [Function], | ||
"getAllByText": [Function], | ||
"getAllByTitle": [Function], | ||
"getByAltText": [Function], | ||
"getByDisplayValue": [Function], | ||
"getByLabelText": [Function], | ||
"getByPlaceholderText": [Function], | ||
"getByRole": [Function], | ||
"getByTestId": [Function], | ||
"getByText": [Function], | ||
"getByTitle": [Function], | ||
"queryAllByAltText": [Function], | ||
"queryAllByDisplayValue": [Function], | ||
"queryAllByLabelText": [Function], | ||
"queryAllByPlaceholderText": [Function], | ||
"queryAllByRole": [Function], | ||
"queryAllByTestId": [Function], | ||
"queryAllByText": [Function], | ||
"queryAllByTitle": [Function], | ||
"queryByAltText": [Function], | ||
"queryByDisplayValue": [Function], | ||
"queryByLabelText": [Function], | ||
"queryByPlaceholderText": [Function], | ||
"queryByRole": [Function], | ||
"queryByTestId": [Function], | ||
"queryByText": [Function], | ||
"queryByTitle": [Function], | ||
"rerender": [Function], | ||
"unmount": [Function], | ||
} | ||
`; |
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.