material-ui

How to add a link to a List in material-ui 1.0?

丶灬走出姿态 提交于 2019-11-30 22:21:31
问题 The following messes with the onClick animation (the ListItem turns red): <List> <a href="https://www.google.com"> <ListItem button> <ListItemText primary="Google" /> </ListItem> </a> </List> While adding the link inside ListItem, only makes the transition work if ListItemText is clicked, which is not what I want. What is the correct way to add a link? 回答1: The easiest way to accomplish this is to make the ListItem a link by using the component prop: <List> <ListItem button component="a" href

How to change Material UI input underline colour?

女生的网名这么多〃 提交于 2019-11-30 20:47:21
I have a Material UI Select component that is on a dark background, so for just this one component I'd like to change it so that the text and line colours are all white. The rest of the Select instances should remain unchanged. While I can get the text and icon to change colour, I can't seem to figure out how to use the classes prop to set the underline colour. My attempts also seem to make the open icon wrap to the next line too. Here's an example demonstrating the problem: I've set my style like this: const styles = theme => ({ underline: { borderBottom: '2px solid white', '&:after': { //

material-ui jss-rtl - after using jss-rtl my page is still LTR

拜拜、爱过 提交于 2019-11-30 17:14:44
问题 I'm using material-ui and next and jss-rtl in my react project but there is a problem the page is still ltr after using <JssProvider ...> -rtl component code: import React from "react"; import { create } from 'jss'; import rtl from 'jss-rtl'; import JssProvider from 'react-jss/lib/JssProvider'; import { createGenerateClassName, jssPreset } from 'material-ui/styles'; // Configure JSS const jss = create({ plugins: [...jssPreset().plugins, rtl()] }); // Custom Material-UI class name generator.

Image on Material UI CardMedia

允我心安 提交于 2019-11-30 16:27:54
I´m having some troubles on getting an image from props on a CardMedia image: <Card className={classes.card}> <CardMedia className={classes.img} image={this.props.recipe.thumbnail} /> <CardContent className={classes.content}> <Typography gutterBottom variant="headline" component="h2"> {this.props.recipe.title} </Typography> <Typography component="p"> {this.props.recipe.ingredients} </Typography> </CardContent> <CardActions> <Button href={this.props.recipe.href} Recipe </Button> </CardActions> </Card> It just doesnt render at all the images; all the other props values are rendered as they has

How to overwrite classes and styles in material-ui (React)

流过昼夜 提交于 2019-11-30 13:57:57
I'm using version 1.2.1 of material-ui and I'm trying to overwrite the AppBar component to be transparent. The documentation outlines how to overwrite styles here . My code: import React, { Component } from 'react'; import AppBar from '@material-ui/core/AppBar'; import Toolbar from '@material-ui/core/Toolbar'; import logo from '../Assets/logo.svg'; class NavigationBar extends Component { render() { const styles = { root: { backgroundColor: 'transparent', boxShadow: 'none', }, }; return ( <AppBar position={this.props.position} classes={{ root: styles.root }}> <Toolbar> <img src={logo} style={{

8 React业务开发

丶灬走出姿态 提交于 2019-11-30 12:17:20
0x0 React16新特性 官网: https://reactjs.org/ 新特性 官方说明 react+react-dom包大小:40k → 30k 整个代码都用Fiber重新了 error boundary 捕获react渲染过程中的错误 可以在正式环境中,弹个提醒告诉用户 错误日志,辅助排错 开发中排错 new render return types render function中支持直接返回数组、字符串 Protals:可以在组件中,把一个标签强制插入到页面任意其他标签下 服务端渲染的升级 - 可以使用「流」的方式做渲染了 在有服务端渲染的情况下,使用hydrate方法渲染客户端内容 0x1 Material-UI的安装和使用 官网: https://www.material-ui.com/ 说明:React components that implement Google's Material Design 注意:需要考虑到服务端渲染相关配置 特点:直接在js里面写css文件,可以有非常好的动态性 目标:展示出来Material-UI的一个Button 基础使用 & 配置服务端渲染 安装 https://material-ui.com/getting-started/installation/ npm i @material-ui/core @material-ui

How to style material-ui textfield

自古美人都是妖i 提交于 2019-11-30 11:08:02
I have been trying to work out how to style a material-ui.next textfield component. <TextField id="email" label="Email" className={classes.textField} value={this.state.form_email} onChange={this.handle_change('form_email')} margin="normal" /> My classes are created as follows: const styles = theme => ({ textField: { width: '90%', marginLeft: 'auto', marginRight: 'auto', color: 'white', paddingBottom: 0, marginTop: 0, fontWeight: 500 }, }); My problem is that I can not seem to get the colour of the text field to change to white. I seem to be able to apply styling to the overall text field

Material-UI withStyles doesn't apply any kind of styles

社会主义新天地 提交于 2019-11-30 09:47:35
问题 I used the example in Material-UI for an AppBar and I simply changed it from a function to a class component, after that I looked at how to use withStyles and I did the exact same thing, but no matter what I do, and what kind of changes I make no style is applied. "react": "^16.8.6", "@material-ui/core": "^4.1.2", "@material-ui/icons": "^4.2.1", import React, {Component} from 'react'; import styleClasses from './SideDrawer.module.css'; import { withStyles } from '@material-ui/styles'; import

How to get Material-UI Drawer to 'squeeze' other content when open

£可爱£侵袭症+ 提交于 2019-11-30 09:36:08
If anyone is familiar with css and Material UI any help with this would be much appreciated. Basically I'm trying to implement a Material UI Drawer component which when opened doesn't just slide out over the top of the page content, but rather the page content conforms around the drawer i.e squeezes or expands. I'm using bootstrap rows and containers in my project, but I have no clue how I'd use them to achieve this. Here's how my component is laid out: <div> <AppBar onLeftIconButtonTouchTap={this.handleToggle} title="Imaginary Company" /> <Row> <QuotesList /> </Row> <Drawer containerStyle={{

How to change outline color of Material UI React input component?

一个人想着一个人 提交于 2019-11-30 09:17:19
问题 I've searched high and low for an answer, in both the docs and other SO questions. I'm using the createMuiTheme option in a separate JS file to override certain default styling, but am having a hard time understanding how the overrides option works. Currently my button looks like this: The code I've got to get this far looks like this: const theme = createMuiTheme({ ...other code, overrides: { MuiFormControlLabel: { focused: { color: '#4A90E2' } }, MuiOutlinedInput: { focused: { border: '1px