This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
-
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 #280 from nekochans/feature/issue276/update-langua…
…ge-button LanguageButton をCSS Modulesを使った形に置換え
- Loading branch information
Showing
5 changed files
with
51 additions
and
43 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,37 @@ | ||
.wrapper { | ||
box-sizing: border-box; | ||
display: flex; | ||
flex: none; | ||
flex-direction: row; | ||
flex-grow: 0; | ||
gap: 10px; | ||
align-items: center; | ||
justify-content: center; | ||
order: 1; | ||
padding: 12px 20px; | ||
border-radius: 4px; | ||
} | ||
|
||
@media (max-width: 767px) { | ||
.wrapper { | ||
padding: 12px 0; | ||
} | ||
} | ||
|
||
.text { | ||
flex: none; | ||
flex-grow: 0; | ||
order: 0; | ||
font-family: Roboto, sans-serif; | ||
font-size: 16px; | ||
font-style: normal; | ||
font-weight: 700; | ||
line-height: 19px; | ||
color: var(--primary-color); | ||
cursor: pointer; | ||
} | ||
|
||
.fa-caret-down { | ||
color: var(--primary-color); | ||
cursor: pointer; | ||
} |
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,6 @@ | ||
declare const styles: { | ||
readonly wrapper: string; | ||
readonly text: string; | ||
readonly 'fa-caret-down': string; | ||
}; | ||
export = styles; |
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,50 +1,16 @@ | ||
import type { FC, MouseEvent } from 'react'; | ||
import { FaCaretDown } from 'react-icons/fa'; | ||
import styled from 'styled-components'; | ||
import { mixins } from '../../styles'; | ||
|
||
const _Wrapper = styled.div` | ||
@media (max-width: ${mixins.mediaQuerySize.default}) { | ||
padding: 12px 0; | ||
} | ||
box-sizing: border-box; | ||
display: flex; | ||
flex: none; | ||
flex-direction: row; | ||
flex-grow: 0; | ||
gap: 10px; | ||
align-items: center; | ||
justify-content: center; | ||
order: 1; | ||
padding: 12px 20px; | ||
border-radius: 4px; | ||
`; | ||
|
||
const _Text = styled.p` | ||
flex: none; | ||
flex-grow: 0; | ||
order: 0; | ||
font-family: Roboto, sans-serif; | ||
font-size: 16px; | ||
font-style: normal; | ||
font-weight: 700; | ||
line-height: 19px; | ||
color: ${mixins.colors.primary}; | ||
cursor: pointer; | ||
`; | ||
|
||
const faCaretDownStyle = { | ||
color: `${mixins.colors.primary}`, | ||
cursor: 'pointer', | ||
}; | ||
import styles from './LanguageButton.module.css'; | ||
|
||
type Props = { | ||
onClick: (event: MouseEvent<HTMLDivElement>) => void; | ||
}; | ||
|
||
export const LanguageButton: FC<Props> = ({ onClick }) => ( | ||
<_Wrapper onClick={onClick}> | ||
<_Text>Language</_Text> | ||
<FaCaretDown style={faCaretDownStyle} /> | ||
</_Wrapper> | ||
// TODO 今はESLintのエラーを無視しているが https://github.com/nekochans/lgtm-cat-ui/issues/279 で修正する | ||
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions | ||
<div className={styles.wrapper} onClick={onClick}> | ||
<p className={styles.text}>Language</p> | ||
<FaCaretDown className={styles['fa-caret-down']} /> | ||
</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
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