-
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.
- Loading branch information
Showing
49 changed files
with
1,253 additions
and
546 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { render } from '@testing-library/react'; | ||
|
||
import { Container } from './Container'; | ||
|
||
describe('Container', () => { | ||
it('should render', () => { | ||
const { container, asFragment } = render(<Container className="pizza" />); | ||
|
||
expect(container.children[0]).toHaveClass('container mx-auto px-4 pizza'); | ||
expect(asFragment()).toMatchSnapshot(); | ||
}); | ||
|
||
it('should render as section', () => { | ||
const { container, asFragment } = render(<Container section />); | ||
|
||
expect(container.children[0].tagName).toBe('SECTION'); | ||
expect(container.children[0]).toHaveClass('container mx-auto px-4'); | ||
expect(asFragment()).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,17 @@ | ||
import clsx from 'clsx'; | ||
import React from 'react'; | ||
|
||
interface Props { | ||
className?: string; | ||
section?: boolean; | ||
} | ||
|
||
export const Container: React.FC<Props> = (props) => { | ||
const className = clsx('container mx-auto px-4', props.className); | ||
|
||
return props.section ? ( | ||
<section className={className}>{props.children}</section> | ||
) : ( | ||
<div className={className}>{props.children}</div> | ||
); | ||
}; |
17 changes: 17 additions & 0 deletions
17
components/Container/__snapshots__/Container.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,17 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Container should render 1`] = ` | ||
<DocumentFragment> | ||
<div | ||
class="container mx-auto px-4 pizza" | ||
/> | ||
</DocumentFragment> | ||
`; | ||
|
||
exports[`Container should render as section 1`] = ` | ||
<DocumentFragment> | ||
<section | ||
class="container mx-auto px-4" | ||
/> | ||
</DocumentFragment> | ||
`; |
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 @@ | ||
export { Container } from './Container'; |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,30 +1,26 @@ | ||
import clsx from 'clsx'; | ||
import React from 'react'; | ||
|
||
import { Container } from '../Container'; | ||
import { Icon } from '../Icon'; | ||
import { Nav } from './Header.blocks'; | ||
import { MainNav } from '../MainNav'; | ||
|
||
interface Props { | ||
text?: string; | ||
transparent?: boolean; | ||
bgClassName?: string; | ||
} | ||
|
||
export const Header: React.VFC<Props> = ({ text, transparent }) => ( | ||
<header | ||
className={clsx( | ||
'z-10 h-16 w-full top-0 fixed', | ||
transparent ? 'bg-secondary-900 opacity-95' : 'bg-secondary-600', | ||
)} | ||
> | ||
<div className="container h-full mx-auto flex items-center justify-between"> | ||
export const Header: React.VFC<Props> = ({ text, bgClassName }) => ( | ||
<header className={clsx('z-10 h-16 w-full top-0 fixed', bgClassName)}> | ||
<Container className="h-full flex items-center justify-between"> | ||
<div className="flex items-center"> | ||
<Icon alt="Logo" name="logo" size={40} link="/" /> | ||
<h4>{text}</h4> | ||
</div> | ||
<div className="flex items-center space-x-8"> | ||
<Nav /> | ||
<MainNav bgClassName={bgClassName} /> | ||
<Icon alt="Peque on GitHub" name="github" size={24} link="https://github.com/pequehq" /> | ||
</div> | ||
</div> | ||
</Container> | ||
</header> | ||
); |
Oops, something went wrong.