前提・実現したいこと
ReactのstyledComponentを用いてSPAの開発をしています。
あらかじめ定義していたstyledComponentを継承してボタンを作っているのですが、そのスタイル継承しつつタグを設定することはできないのでしょうか?
例えば、buttonタグで作ったもののスタイルを継承しつつ、それをaタグとして使えないでしょうか?
ソースコード
jsx
1 2export const Button = styled.button` 3 font-size: 13px; 4 border-radius: 20px; 5 height: 30px; 6 padding:0; 7 cursor: pointer; 8 transition: all .2s ease; 9 font-weight: bold; 10 min-width: ${props => props.width ? props.width : '100px'}; 11 &:hover { 12 opacity:0.7; 13 } 14`; 15------------------ 16 17const TwitterBtn = Button.extend`←ここでaタグを指定したい 18 border-radius: 100px; 19 width: 220px; 20 height: 41px; 21 margin: 0 auto; 22`; 23 24render(){ 25 return ( 26 <TwitterBtn> 27 Twitterで新規登録 28 </TwitterBtn> 29 ) 30} 31 32
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/03/19 09:46