Skip to content

Commit

Permalink
Add prop "month" of SelectBox
Browse files Browse the repository at this point in the history
  • Loading branch information
jun68ykt committed Sep 3, 2020
1 parent 6bb1e4d commit 95aad64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/SelectDate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const Container = styled.div`
`;

type TSelectBox = {
active: boolean
active: boolean;
month: number;
}
const SelectBox = styled.div<TSelectBox>`
display: flex;
Expand Down Expand Up @@ -62,9 +63,9 @@ const SelectBox = styled.div<TSelectBox>`
margin-bottom: 8px;
position: relative;
order: 0;
.name {
p {
display: inline-block;
color: rgba(0, 0, 0, 0.87);
color: ${({ month }: TSelectBox) => month ? 'blue' : 'rgba(0, 0, 0, 0.87)'};
font-size: 16px;
}
}
Expand Down Expand Up @@ -99,7 +100,7 @@ export const SelectDate: FunctionComponent = () => {

return (
<Container>
<SelectBox active={active}>
<SelectBox active={active} month={selectedMonth}>
<div className="option-container">
{months.map((month, i) => (
<div className="option" key={i} onClick={() => handleSelectingOption(month)}>
Expand All @@ -110,7 +111,7 @@ export const SelectDate: FunctionComponent = () => {
))}
</div>
<div className="selected" onClick={handleActive}>
{selectedMonth > 0 ? `${selectedMonth}月` : `年`}
<p>{selectedMonth || ''}</p>
</div>
</SelectBox>
</Container>
Expand Down
1 change: 1 addition & 0 deletions src/react-app-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="react-scripts" />

0 comments on commit 95aad64

Please sign in to comment.