-
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.
Move button to separate component (#117)
- Loading branch information
1 parent
7e0c489
commit d2ae7e7
Showing
5 changed files
with
93 additions
and
44 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 cn from 'classnames' | ||
import styles from './Button.module.css' | ||
|
||
export function Button({ link, type = 'primary', size = 'small', onClick, children }) { | ||
const className = cn( | ||
styles.Button, | ||
styles[`Button_type-${type}`], | ||
styles[`Button_size-${size}`] | ||
) | ||
|
||
return link ? ( | ||
<a className={className} href={link} target="_blank" rel="noreferrer" onClick={onClick}> | ||
{children} | ||
</a> | ||
) : ( | ||
<button type="button" className={className} onClick={onClick}> | ||
{children} | ||
</button> | ||
) | ||
} |
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,46 @@ | ||
.Button { | ||
display: inline-block; | ||
border: 0; | ||
border-radius: 40px; | ||
font-weight: 400; | ||
font-size: 15px; | ||
line-height: 1.33; | ||
text-decoration: 0; | ||
white-space: nowrap; | ||
cursor: pointer; | ||
transition: all 0.15s ease; | ||
} | ||
|
||
.Button_type-primary { | ||
background: black; | ||
color: white; | ||
} | ||
|
||
.Button_type-secondary { | ||
background: #ffd400; | ||
color: black; | ||
} | ||
|
||
.Button_type-secondary:hover { | ||
background: #e1bb00; | ||
} | ||
|
||
.Button_size-small { | ||
padding: 8px 12px; | ||
} | ||
|
||
.Button_size-large { | ||
padding: 12px 32px; | ||
} | ||
|
||
@media screen and (min-width: 768px) { | ||
.Button { | ||
font-size: 16px; | ||
} | ||
} | ||
|
||
@media screen and (min-width: 1200px) { | ||
.Button { | ||
font-size: 18px; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,28 +1,27 @@ | ||
import React from 'react' | ||
|
||
import cn from 'classnames' | ||
import { Button } from '../Button/Button' | ||
import Github from './github.svg' | ||
|
||
import styles from './ProjectLinks.module.css' | ||
|
||
import Github from './github.svg' | ||
|
||
export function ProjectLinks() { | ||
return ( | ||
<div className={cn(styles.ProjectLinks)}> | ||
<a | ||
className={cn(styles.ProjectLinks__button, styles.ProjectLinks__button_about)} | ||
className={cn(styles.ProjectLinks__github)} | ||
href="https://github.com/ekaterinburgdev/guides" | ||
target="_blank" | ||
aria-label="Код проекта на GitHub" | ||
> | ||
<Github /> | ||
</a> | ||
<a | ||
className={cn(styles.ProjectLinks__button, styles.ProjectLinks__button_feedback)} | ||
href="https://tally.so#tally-open=w5ZYXd&tally-width=650&tally-overlay=1&tally-emoji-animation=none" | ||
<Button | ||
type="secondary" | ||
link="https://tally.so#tally-open=w5ZYXd&tally-width=650&tally-overlay=1&tally-emoji-animation=none" | ||
> | ||
Фидбек | ||
</a> | ||
</Button> | ||
</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