-
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 #335 from kure-kosen/react/sidebar-radio
popular radioの実装
- Loading branch information
Showing
22 changed files
with
615 additions
and
283 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,72 @@ | ||
import styled from "styled-components"; | ||
import * as React from "react"; | ||
import { Link } from "react-router-dom"; | ||
import styled, { css } from "styled-components"; | ||
|
||
import { chkColors } from "./color"; | ||
|
||
export const ChkButtonBase = styled.div` | ||
interface IPropsCss { | ||
color?: string; | ||
bgcolor?: string; | ||
border?: string; | ||
} | ||
|
||
interface IPropsChkButtonBase extends IPropsCss { | ||
to?: string; | ||
text: string | React.ReactNode; | ||
name?: string; | ||
} | ||
|
||
const ChkButtonBase = (props: IPropsChkButtonBase) => { | ||
const { to, text, name } = props; | ||
const { color, bgcolor, border } = props; | ||
|
||
if (to) { | ||
if (to.startsWith("http")) { | ||
return ( | ||
<ATag color={color} bgcolor={bgcolor} border={border} href={to}> | ||
{text} | ||
</ATag> | ||
); | ||
} else { | ||
return ( | ||
<LinkTag color={color} bgcolor={bgcolor} border={border} to={to}> | ||
{text} | ||
</LinkTag> | ||
); | ||
} | ||
} else { | ||
return ( | ||
<ButtonTag name={name} color={color} bgcolor={bgcolor} border={border}> | ||
{text} | ||
</ButtonTag> | ||
); | ||
} | ||
}; | ||
|
||
const ButtonStyle = css` | ||
display: block; | ||
color: white; | ||
width: 100%; | ||
margin: 0; | ||
padding: 10px; | ||
outline: none; | ||
border-style: none; | ||
box-shadow: 4px 3px 10px 0px ${chkColors.shadow}; | ||
border-radius: 20px; | ||
text-align: center; | ||
margin: 0; | ||
padding: 10px; | ||
width: 100%; | ||
line-height: 1.5rem; | ||
border-radius: 1.5rem; | ||
background-color: ${chkColors.orange}; | ||
color: ${(props: IPropsCss) => (props.color ? chkColors[props.color] : chkColors.white)}; | ||
border: ${(props: IPropsCss) => (props.border ? `2px solid ${chkColors[props.border]}` : "none")}; | ||
background-color: ${(props: IPropsCss) => (props.bgcolor ? chkColors[props.bgcolor] : chkColors.orange)}; | ||
`; | ||
|
||
const ButtonTag = styled.button` | ||
${ButtonStyle} | ||
`; | ||
|
||
const LinkTag = styled(Link)` | ||
${ButtonStyle} | ||
`; | ||
|
||
const ATag = styled.a` | ||
${ButtonStyle} | ||
`; | ||
|
||
export default ChkButtonBase; |
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
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
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,16 +1,15 @@ | ||
import * as React from "react"; | ||
import styled from "styled-components"; | ||
|
||
import { ChkButtonBase } from "./../commons/ChkButtonBase"; | ||
import { chkColors } from "./../commons/color"; | ||
import ChkButtonBase from "../commons/ChkButtonBase"; | ||
|
||
export const FeaturedPersonalityButton = () => <PersonalityButton>personality list</PersonalityButton>; | ||
export const FeaturedPersonalityButton = () => ( | ||
<Wrapper> | ||
<ChkButtonBase to="/personality" text="personality list" /> | ||
</Wrapper> | ||
); | ||
|
||
const PersonalityButton = ChkButtonBase.extend` | ||
background-color: ${chkColors.orange}; | ||
const Wrapper = styled.div` | ||
margin: 0 auto; | ||
width: 210px; | ||
height: 48px; | ||
margin-top: 40px; | ||
margin-left: auto; | ||
margin-right: auto; | ||
border-radius: 20px; | ||
`; |
16 changes: 9 additions & 7 deletions
16
frontend/src/components/FeaturedPersonalityListenToRadioButton.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,14 +1,16 @@ | ||
import * as React from "react"; | ||
import styled from "styled-components"; | ||
|
||
import { ChkButtonBase } from "./../commons/ChkButtonBase"; | ||
import { chkColors } from "./../commons/color"; | ||
import ChkButtonBase from "../commons/ChkButtonBase"; | ||
|
||
export const FeaturedPersonalityListenToRadioButton = () => <ListenToButton>listen to radio</ListenToButton>; | ||
export const FeaturedPersonalityListenToRadioButton = () => ( | ||
<Wrapper> | ||
<ChkButtonBase to="/" text="listen to radio" bgcolor="blue" /> | ||
</Wrapper> | ||
); | ||
|
||
const ListenToButton = ChkButtonBase.extend` | ||
background-color: ${chkColors.blue}; | ||
const Wrapper = styled.div` | ||
margin: 0 auto; | ||
height: 35px; | ||
width: 60%; | ||
margin: 0 auto; | ||
border-radius: 20px; | ||
`; |
Oops, something went wrong.