This repository was archived by the owner on Jan 14, 2025. It is now read-only.
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
Drawer Component css style issue ? #557
Closed
Description
I tried to import drawer component but is not reflecting css in React App
https://github.com/material-components/material-components-web-react/tree/master/packages/drawer
app.scss file i added css code it's reflecting..
.drawer-container {
display: flex;
flex-direction: row;
height: 100vh;
overflow: hidden;
}
.drawer-app-content {
flex: auto;
overflow: auto;
}
but this style css not working.
import '@material/react-drawer/index.scss';
import "@material/react-drawer/dist/drawer.css";
Step 1
i have created React App. using given below cmd
npx create-react-app my-app
cd my-app
npm start
Step 2
Git command propmt
SET SASS_PATH=.\node_modules
after that
npm install node-sass
Step 3
git command propmt
npm install @material/react-drawer
npm install @material/react-list
npm install @material/react-material-icon
npm install @material/react-top-app-bar
Step 4
App.js file
import React, {Component} from 'react';
import TopAppBar, {TopAppBarFixedAdjust} from '@material/react-top-app-bar';
import Drawer, {DrawerAppContent, DrawerContent, DrawerHeader, DrawerTitle} from '@material/react-drawer';
import MaterialIcon from '@material/react-material-icon';
import List, {ListItem, ListItemGraphic, ListItemText} from '@material/react-list';
// includes imports for drawer, list, material icon and top app bar styles
import './App.scss';
import '@material/react-drawer/index.scss';
import "@material/react-drawer/dist/drawer.css";
export default class App extends Component {
state = {selectedIndex: 0};
render() {
return (
<div className='drawer-container'>
<TopAppBar title='Inbox'/>
<TopAppBarFixedAdjust>
<Drawer>
<DrawerHeader>
<DrawerTitle tag='h2'>
[email protected]
</DrawerTitle>
</DrawerHeader>
<DrawerContent>
<List singleSelection selectedIndex={this.state.selectedIndex}>
<ListItem>
<ListItemGraphic graphic={<MaterialIcon icon='folder'/>} />
<ListItemText primaryText='Mail' />
</ListItem>
</List>
</DrawerContent>
</Drawer>
<DrawerAppContent className='drawer-app-content'>
Your inbox content
</DrawerAppContent>
</TopAppBarFixedAdjust>
</div>
);
}
}
Output is like.
Metadata
Metadata
Assignees
Labels
No labels