Skip to content
This repository was archived by the owner on Jul 29, 2025. It is now read-only.

Commit fd30502

Browse files
author
Matt Goo
authored
fix: [email protected] --> [email protected] & update imports (#709)
1 parent b15c780 commit fd30502

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+213
-83
lines changed

docs/best-practices.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,22 @@ By not including the font icon inside your CSS file, it reduces the file size. B
1414
### Use with MDC Ripple
1515

1616
If you load your font icons with a [Ripple](../packages/ripple) with the above method, you will need to set the height and width of the icons. This is because MDC Ripple calculates the ripple size from the initial height/width.
17+
18+
### Importing packages
19+
20+
References:
21+
- https://stackoverflow.com/questions/29596714/new-es6-syntax-for-importing-commonjs-amd-modules-i-e-import-foo-require
22+
- https://github.com/basarat/typescript-book/blob/master/docs/project/external-modules.md
23+
- https://github.com/Microsoft/TypeScript/issues/2242#issuecomment-92218146
24+
- https://github.com/Microsoft/TypeScript/issues/2242#issuecomment-83694181
25+
26+
Since `[email protected]` is exporting `default`, we should be importing as such:
27+
```ts
28+
// referenced in https://github.com/basarat/typescript-book/blob/master/docs/project/external-modules.md#default-exportsimports
29+
import classnames from 'classnames';
30+
```
31+
32+
In other cases where we import modules that do not use `default`, we should import like:
33+
```ts
34+
import * as classnames from 'classnames';
35+
```

packages/button/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525
import * as Ripple from '@material/react-ripple';
2626

2727
const BUTTON_CLASS_NAME = 'mdc-button__icon';

packages/button/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"dependencies": {
2020
"@material/button": "^0.43.0",
2121
"@material/react-ripple": "^0.10.0",
22-
"classnames": "^2.2.5",
22+
"classnames": "^2.2.6",
2323
"react": "^16.4.2"
2424
},
2525
"publishConfig": {

packages/card/ActionButtons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525

2626
type ChildType = React.ReactElement<React.HTMLProps<HTMLButtonElement|HTMLAnchorElement>>;
2727

packages/card/ActionIcons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525

2626
type ChildType = React.ReactElement<React.HTMLProps<HTMLImageElement|HTMLOrSVGElement>>;
2727

packages/card/Actions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525

2626
export interface ActionsProps extends React.HTMLProps<HTMLDivElement> {
2727
className?: string;

packages/card/Media.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525

2626
export interface MediaProps extends React.HTMLProps<HTMLDivElement> {
2727
className?: string;

packages/card/PrimaryContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525
import * as Ripple from '@material/react-ripple';
2626

2727
export interface PrimaryContentBaseProps extends React.HTMLProps<HTMLDivElement>, Ripple.InjectedProps<HTMLDivElement>{

packages/card/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525
import ActionButtons from './ActionButtons';
2626
import ActionIcons from './ActionIcons';
2727
import Actions from './Actions';

packages/card/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"dependencies": {
2020
"@material/card": "^0.41.0",
2121
"@material/react-ripple": "^0.10.0",
22-
"classnames": "^2.2.5",
22+
"classnames": "^2.2.6",
2323
"react": "^16.4.2"
2424
},
2525
"publishConfig": {

0 commit comments

Comments
 (0)