ฉันยังใหม่กับ React และ Material UI ฉันกำลังพยายามเพิ่มสไตล์ที่กำหนดเองให้กับปุ่ม MUI โดยใช้ createMuiTheme
ฉันได้ติดตามเอกสารและคัดลอกตัวอย่างไปเกือบหมดแล้ว แต่ไม่มีผลใด ๆ และไม่มีข้อผิดพลาดเกิดขึ้นในคอนโซล
ฉันต่อสู้กับสิ่งนี้มาระยะหนึ่งแล้ว และฉันไม่รู้ว่าปัญหาคืออะไร ฉันพลาดอะไรไป
import React from 'react';
import { createMuiTheme } from '@material-ui/core/styles';
import { ThemeProvider } from '@material-ui/styles';
import Button from '@material-ui/core/Button';
const mytheme = createMuiTheme({
palette: {
primary: { main: '#1565C0'},
secondary: { main: '#11cb5f' },
},
});
export const PrimaryButton = (props) => {
return (
<ThemeProvider theme={mytheme}>
<a href={props.buttonLink}>
<Button
style={{ ...props.styles}}
onClick={props.handleClick}
variant='contained' color='primary' size='large'
>
{props.buttonText}
</Button>
</a>
</ThemeProvider>
);
};
export const SecondaryButton = (props) => {
return (
<ThemeProvider theme={mytheme}>
<Button
style={{...props.styles }}
value={props.value || ''}
onClick={props.handleClick}
variant='outlined' color='secondary' size='large'
>
{props.buttonText}
</Button>
</ThemeProvider>
)
}
@material-ui/styles
หลายอินสแตนซ์หรือไม่ - person Ryan Cogswell   schedule 17.12.2019