-
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 #373 from kure-kosen/react/create-radio-card
React/create radio card
- Loading branch information
Showing
7 changed files
with
213 additions
and
61 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
frontend/src/components/atoms/RadioCard/RadioCardContent.tsx
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,28 @@ | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
|
||
import { IRadio } from "@/api/RadioApi"; | ||
import { color } from "@/constants/styles"; | ||
|
||
export default (props: Pick<IRadio, "title" | "description">) => { | ||
const { title, description } = props; | ||
|
||
return ( | ||
<Wrapper> | ||
<Title>{title}</Title> | ||
<Description dangerouslySetInnerHTML={{ __html: description }} /> | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
const Wrapper = styled.div` | ||
width: 100%; | ||
height: 100%; | ||
`; | ||
|
||
const Title = styled.h3` | ||
font-size: 1.2rem; | ||
color: ${color.BLUE}; | ||
text-align: center; | ||
`; | ||
const Description = styled.p``; |
32 changes: 32 additions & 0 deletions
32
frontend/src/components/atoms/RadioCard/RadioCardImage.tsx
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,32 @@ | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
|
||
import { IRadio } from "@/api/RadioApi"; | ||
import { color } from "@/constants/styles"; | ||
|
||
export default (props: Pick<IRadio, "image">) => { | ||
const { image } = props; | ||
|
||
return ( | ||
<Wrapper> | ||
<Image src={image} /> | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
const Wrapper = styled.div` | ||
width: 100%; | ||
`; | ||
|
||
const Image = styled.img` | ||
object-fit: cover; | ||
width: calc(100% + 6px); | ||
margin-top: -3px; | ||
margin-left: -3px; | ||
border-top-left-radius: 8px; | ||
border-top-right-radius: 8px; | ||
border-top: 3px solid ${color.SKY_BLUE}; | ||
border-left: 3px solid ${color.SKY_BLUE}; | ||
border-right: 3px solid ${color.SKY_BLUE}; | ||
border-bottom: 3px solid ${color.SKY_BLUE}; | ||
`; |
53 changes: 53 additions & 0 deletions
53
frontend/src/components/atoms/RadioCard/RadioCardPlayButton.tsx
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,53 @@ | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
|
||
import { IRadio } from "@/api/RadioApi"; | ||
import { color } from "@/constants/styles"; | ||
|
||
export default (props: Pick<IRadio, "mp3" | "play_time">) => { | ||
const { mp3, play_time } = props; | ||
|
||
const isPlay = !false; | ||
|
||
return ( | ||
<Wrapper> | ||
<ButtonWrapper> | ||
{isPlay ? ( | ||
<PlayButton className="fas fa-play" /> | ||
) : ( | ||
<PauseButton className="fas fa-pause" /> | ||
)} | ||
</ButtonWrapper> | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
const Wrapper = styled.div` | ||
position: absolute; | ||
top: ${220 - 32 / 2}px; | ||
left: 0; | ||
right: 0; | ||
margin: 0 auto; | ||
width: 32px; | ||
height: 32px; | ||
background-color: ${color.ORANGE}; | ||
border: 3px solid ${color.VIVID_ORANGE}; | ||
border-radius: 50%; | ||
`; | ||
|
||
const ButtonWrapper = styled.div` | ||
text-align: center; | ||
margin-top: -2px; | ||
`; | ||
|
||
const ButtonBase = styled.i` | ||
line-height: 32px; | ||
font-size: 0.7rem; | ||
color: ${color.WHITE}; | ||
`; | ||
|
||
const PlayButton = styled(ButtonBase)` | ||
padding-left: 2.5px; | ||
`; | ||
|
||
const PauseButton = styled(ButtonBase)``; |
26 changes: 21 additions & 5 deletions
26
frontend/src/components/molecules/RadioCard/RadioCardWrapper.tsx
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,13 +1,29 @@ | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
|
||
import card from "./radio-card.png"; | ||
import { IRadio } from "@/api/RadioApi"; | ||
import { color } from "@/constants/styles"; | ||
|
||
export default () => <RadioCardWrapperStyle />; | ||
import CardImage from "@/components/atoms/RadioCard/RadioCardImage"; | ||
import CardContent from "@/components/atoms/RadioCard/RadioCardContent"; | ||
import PlayButton from "@/components/atoms/RadioCard/RadioCardPlayButton"; | ||
|
||
export default (props: IRadio) => { | ||
const { title, description, mp3, image, play_time } = props; | ||
|
||
return ( | ||
<RadioCardWrapperStyle> | ||
<CardImage image={image} /> | ||
<PlayButton mp3={mp3} play_time={play_time} /> | ||
<CardContent title={title} description={description} /> | ||
</RadioCardWrapperStyle> | ||
); | ||
}; | ||
|
||
const RadioCardWrapperStyle = styled.div` | ||
width: 282px; | ||
width: 280px; | ||
height: 445px; | ||
background-image: url(${card}); | ||
background-size: cover; | ||
border-radius: 8px; | ||
border: 3px solid ${color.SKY_BLUE}; | ||
position: relative; | ||
`; |
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 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