Q_Q ..
产生一个 div,写 css style,放进变数里变成 component 使用
命名习惯 Styled+谁
import styled from 'styled-components'
import { ReactComponent as Logo } from '../../images/logo/logo/.svg'
// components 命名要大写开头
const StyledDiv = styled.div`
color: red;
`;
// 本来就有的组件,就用()包起来,喂样式
const StyledLogo = styled(Logo)`
fill: orange;
`;
const HomeSection= () => {
return (
<section>
// inline-style
<div style={{ color: 'red' }}> this is txt </div>
// 等同於 styled-components
// 实际会被转成 <div class="sc-xxx xxxx">this is txt </div>
<StyledDiv>this is txt</StyledDiv>
<Logo style={{ fill: 'orange' }} />
// 等同於
<StyledLogo>
</section>
)
}
export default HomeSection;
<<: [Day26] String methods 字串操作方法(1)
1. 为什麽要学 Git,可以做什麽呢? 学习到现在大家一定累积很多的程序码或是各式的档案,如何去做...
今天介绍的内容为角色攻击,玩家透过滑鼠发动攻击。 ...
前言 主要籍由这个主题,熟悉永丰金融API的相关操作。 将系列文章 做一下规划 环境建置 API串接...
既然我们都已经有了上传资料,当然我们也要有可以看我们所有上架内容的地方,还有下架资料的地方啦!! ...
前言 今天来设置 RecipeList APP 的 tab。 实作 我将要做两个选项卡, 第一个是一...