-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React/create radio card #373
Merged
+213
−61
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a46b28e
add VIVID_ORANGE
kobakazu0429 c3be4c7
add observer
kobakazu0429 a2bd607
add
kobakazu0429 37989bf
create RadioCardImage and RadioCardContent
kobakazu0429 2a73a9d
create RadioCardPlayButton
kobakazu0429 24a2892
fix orange color
kobakazu0429 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここはmarkdownを受け取るようになるんだよね?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これは前のAPIからhtmlを受け取ってます
別PRでmarkdownをパースして描画するようにしてます!