Skip to content

Commit bb5a92f

Browse files
committed
Use named imports for rollup to find mdc react packages
1 parent f074ddc commit bb5a92f

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<html>
22

33
<head>
4-
<style href="style.css"></style>
4+
<link rel ="stylesheet" type="text/css" href="style.css"></style>
55
</head>
66

77
<body>

dist/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
@import "@material/react-chips/dist/chips.css";
1+
@import "../node_modules/@material/react-chips/dist/chips.css";

rollup.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ export default {
1919
include: 'node_modules/**',
2020
namedExports: {
2121
'node_modules/react/index.js': ['cloneElement', 'createRef', 'Component', 'PureComponent', 'Fragment', 'Children', 'createElement', 'forwardRef'],
22-
'node_modules/react-dom/index.js': ['findDOMNode', 'unstable_batchedUpdates', 'render']
22+
'node_modules/react-dom/index.js': ['findDOMNode', 'unstable_batchedUpdates', 'render'],
23+
'@material/react-chips': ["Chip", "ChipSet"]
2324
}
2425
}),
2526
typescript()

src/App.tsx

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
11
import * as React from 'react';
22
import { Chip, ChipSet } from '@material/react-chips';
33

4-
export class App extends React.Component {
4+
export type Season = 'summer' | 'winter' | 'spring' | 'fall';
5+
6+
const seasons: Season[] = [
7+
'summer', 'winter', 'spring', 'fall'
8+
];
9+
10+
export class App extends React.Component<React.HTMLProps<HTMLDivElement>, { season?: Season }> {
11+
constructor(props: React.HTMLProps<HTMLDivElement>) {
12+
super(props);
13+
this.state = {};
14+
};
15+
516
render() {
17+
const seasonComponents = seasons.map(s =>
18+
<Chip selected={this.state.season === s}
19+
handleSelect={this.handleSelect.bind(this, s)}
20+
id={s}
21+
label={s}
22+
/>);
23+
624
return (
7-
<ChipSet>
8-
<Chip id='summer' label='Summer' />
9-
<Chip id='winter' label='Winter' />
25+
<ChipSet filter={true}>
26+
{seasonComponents}
1027
</ChipSet>
1128
);
1229
}
30+
31+
handleSelect(id: Season) {
32+
this.setState({ season: id });
33+
}
1334
}

0 commit comments

Comments
 (0)