Day 26 - styled-components 笔记1

Q_Q ..

styled.div

产生一个 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)

>>:  重新建构销售流程

Day 28 : Git

1. 为什麽要学 Git,可以做什麽呢? 学习到现在大家一定累积很多的程序码或是各式的档案,如何去做...

Unity与Photon的新手相遇旅途 | Day10-角色攻击

今天介绍的内容为角色攻击,玩家透过滑鼠发动攻击。 ...

Day 1-开始上路罗~!

前言 主要籍由这个主题,熟悉永丰金融API的相关操作。 将系列文章 做一下规划 环境建置 API串接...

【Day11】HomeFragment X RecyclerView X Firestore取/删除资料

既然我们都已经有了上传资料,当然我们也要有可以看我们所有上架内容的地方,还有下架资料的地方啦!! ...

Day26:TabView

前言 今天来设置 RecipeList APP 的 tab。 实作 我将要做两个选项卡, 第一个是一...