-
Notifications
You must be signed in to change notification settings - Fork 0
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 #50 from manh-t/feature/9-ui-dashboard-empty
[#9] [UI] As a user, I can see the empty Dashboard page
- Loading branch information
Showing
7 changed files
with
116 additions
and
15 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,17 @@ | ||
import React from 'react'; | ||
|
||
import { render, screen } from '@testing-library/react'; | ||
|
||
import DashboardEmpty from '.'; | ||
|
||
describe('DashboardEmpty', () => { | ||
it('renders DashboardEmpty and its components', () => { | ||
const dataTestId = 'dashboard-empty'; | ||
render(<DashboardEmpty data-test-id={dataTestId} />); | ||
|
||
const dashboardEmpty = screen.getByTestId(dataTestId); | ||
|
||
expect(dashboardEmpty).toBeVisible(); | ||
expect(dashboardEmpty).toHaveTextContent('😎You‘ve completed all the surveys.Take a moment.'); | ||
}); | ||
}); |
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,20 @@ | ||
import React from 'react'; | ||
|
||
interface DashboardEmptyProps { | ||
'data-test-id'?: string; | ||
} | ||
|
||
const DashboardEmpty = (attributes: DashboardEmptyProps): JSX.Element => { | ||
return ( | ||
<div className="flex flex-col items-center" {...attributes}> | ||
<p className="text-[64px]">😎</p> | ||
<p className="text-white text-large font-[850] text-center mt-8"> | ||
You‘ve completed all the surveys. | ||
<br /> | ||
Take a moment. | ||
</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default DashboardEmpty; |
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 from 'react'; | ||
|
||
import { render, screen } from '@testing-library/react'; | ||
|
||
import DashboardHeader from '.'; | ||
|
||
describe('DashboardHeader', () => { | ||
const dataTestId = 'dashboard-header'; | ||
it('renders DashboardHeader and its components', () => { | ||
const dateTime = 'Monday, JUNE 15'; | ||
const daysAgo = 'Today'; | ||
const profileUrl = 'test url'; | ||
render( | ||
<DashboardHeader dateTime={dateTime} daysAgo={daysAgo} profileUrl={profileUrl} data-test-id={dataTestId}> | ||
Dashboard Header | ||
</DashboardHeader> | ||
); | ||
|
||
const dashboardHeader = screen.getByTestId(dataTestId); | ||
const avatar = screen.getByAltText('user avatar'); | ||
|
||
expect(dashboardHeader).toBeVisible(); | ||
expect(dashboardHeader).toHaveTextContent(dateTime); | ||
expect(dashboardHeader).toHaveTextContent(dateTime); | ||
expect(dashboardHeader).toHaveTextContent(dateTime); | ||
|
||
expect(avatar).toBeVisible(); | ||
expect(avatar).toHaveAttribute('src', profileUrl); | ||
}); | ||
}); |
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,36 @@ | ||
import React from 'react'; | ||
|
||
import { ReactComponent as NimbleLogoWhite } from 'assets/images/icons/nimble-logo-white.svg'; | ||
|
||
interface DashboardHeaderProps { | ||
dateTime: string; | ||
daysAgo: string; | ||
profileUrl: string; | ||
children: React.ReactNode; | ||
'data-test-id'?: string; | ||
} | ||
const DashboardHeader = ({ dateTime, daysAgo, profileUrl, children, ...rest }: DashboardHeaderProps): JSX.Element => { | ||
return ( | ||
<header className="flex flex-col min-h-screen" {...rest}> | ||
<div className="flex justify-between pt-8"> | ||
<NimbleLogoWhite /> | ||
<img className="w-[36px] h-[36px] rounded-full" src={profileUrl} alt="user avatar" /> | ||
</div> | ||
<div className="flex justify-between"> | ||
<div className="w-1/5"></div> | ||
<div className="flex flex-col text-white mt-10 flex-1"> | ||
<p className="text-x-small font-extrabold">{dateTime}</p> | ||
<p className="text-x-large font-extrabold mt-1">{daysAgo}</p> | ||
</div> | ||
<div className="w-1/5"></div> | ||
</div> | ||
<div className="flex justify-between mt-8 grow"> | ||
<div className="w-1/5"></div> | ||
<div className="flex-1">{children}</div> | ||
<div className="w-1/5"></div> | ||
</div> | ||
</header> | ||
); | ||
}; | ||
|
||
export default DashboardHeader; |
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