[Day 6] Button

Day 5

进到了网站中最常见需要做功能性的环节
Button

  <Button variant="outlined" color="primary" >
      Primary
    </Button>

其中 variant 叙述的是语意
可以给的参数有 contained . outlined 或是 text

color意思更明确 可以给基础颜色 或通常以颜色定义功能

'default' 'inherit' 'primary' 'secondary'

https://ithelp.ithome.com.tw/upload/images/20210907/20098345b8D5ktfTrI.png
另外需要特殊样式可以去建构其样式再喂入Button中

const ColorButton = withStyles(theme => ({
 root: {
   color: theme.palette.getContrastText(purple[500]),
   backgroundColor: purple[500],
   '&:hover': {
     backgroundColor: purple[700],
   },
 },
}))(Button);

把特殊样式定义成特殊元件

      <ColorButton variant="contained" color="primary" className={classes.margin}>
       Custom CSS
     </ColorButton>

这边另外要引入

import { purple } from "@material-ui/core/colors";
内建的颜色 purple紫色参数
import { withStyles } from "@material-ui/core/styles";
跟要新增样式的 withStyles

这样一个特殊样式的按钮就做完了

Day 6


<<:  D6 - 如何用 Google Apps Script 将 Google 表单收到的时间同步在 Google Calendar 上?

>>:  从架构开始重新认识Day2

杂谈    

Elastic Stack第二十七重

Filebeat 本篇介绍filebeat是什麽以及如何安装及建置 下一篇浏览此篇建置完成的kiba...

ASP.NET MVC 从入门到放弃(Day9) -C# nwe 建构子 static 介绍

接着来讲讲new 建构值部分.... public class Yaowen { public Ya...

成为工具人应有的工具包-22 OpenedFilesView

OpenedFilesView 今天来认识 OpenedFilesView 顾名思义应该就是可以看到...

自动化测试,让你上班拥有一杯咖啡的时间 | Day 13 - 动态跳过测试用例

此系列文章会同步发文到个人部落格,有兴趣的读者可以前往观看喔。 测试脚本中有许多测试用例时,当需要...

Day 05 关键字比对,让你花钱不浪费

我们想像今天有个消费者想要搜寻「五倍红宝石」,却只用了「红宝石」这个关键字,他可能会搜出一堆「红宝石...