-
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.
- Loading branch information
Showing
4 changed files
with
96 additions
and
0 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,47 @@ | ||
@use '../../styles/variables'; | ||
@use '../../styles/theme'; | ||
@use '../../styles/mixins/responsive'; | ||
|
||
// | ||
// Logo | ||
// -------------------------------- | ||
|
||
.brand { | ||
align-self: center; | ||
text-align: center; | ||
} | ||
|
||
.logo { | ||
max-width: 100%; | ||
max-height: variables.$header-height - 10px; | ||
max-height: 36px; | ||
vertical-align: middle; | ||
cursor: pointer; | ||
} | ||
|
||
// | ||
// mediaQueries | ||
// -------------------------------- | ||
|
||
@include responsive.mobile-and-tablet() { | ||
.brand { | ||
flex: 1; | ||
|
||
.logo { | ||
max-height: variables.$header-height-mobile - 20px; | ||
} | ||
} | ||
} | ||
|
||
@include responsive.mobile-only() { | ||
.brand { | ||
transition: opacity 0.2s ease; | ||
} | ||
} | ||
|
||
@include responsive.desktop-only() { | ||
.brand { | ||
width: 180px; | ||
text-align: left; | ||
} | ||
} |
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,13 @@ | ||
import React from 'react'; | ||
|
||
import { render } from '../../testUtils'; | ||
|
||
import Logo from './Logo'; | ||
|
||
describe('<Logo/>', () => { | ||
it('renders and matches snapshot', () => { | ||
const { container } = render(<Logo src="123" />); | ||
|
||
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,24 @@ | ||
import React from 'react'; | ||
import { useHistory } from 'react-router-dom'; | ||
|
||
import styles from './Logo.module.scss'; | ||
|
||
type LogoProps = { | ||
src: string; | ||
}; | ||
|
||
const Logo: React.FC<LogoProps> = ({ src }: LogoProps) => { | ||
const history = useHistory(); | ||
|
||
const handleClick = () => { | ||
history.push('/'); | ||
}; | ||
|
||
return ( | ||
<div className={styles.brand}> | ||
<img className={styles.logo} alt="logo" src={src} onClick={handleClick} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Logo; |
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 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<Logo/> renders and matches snapshot 1`] = ` | ||
<div> | ||
<div> | ||
<img | ||
alt="logo" | ||
src="123" | ||
/> | ||
</div> | ||
</div> | ||
`; |