Skip to content

Commit

Permalink
[docs] Font vs SVG. Which approach to use? (mui#12466)
Browse files Browse the repository at this point in the history
* Update icons.md

* all good for me
  • Loading branch information
PolGuixe authored and oliviertassinari committed Aug 11, 2018
1 parent 22ac668 commit 49a74ad
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 101 deletions.
7 changes: 7 additions & 0 deletions docs/src/pages/style/icons/icons.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,10 @@ Optionally, you can set the icon color using one of the theme color properties:
### [Font Awesome](https://fontawesome.com/icons)

{{"demo": "pages/style/icons/FontAwesome.js", "hideEditButton": true}}

## Font vs SVG. Which approach to use?

Both approaches work fine, however, there are some subtle differences, especially in terms of performance and rendering quality.
Whenever possible SVG is preferred as it allows code splitting, supports more icons, renders faster and better.

For more details, you can check out [why GiHub migrated](https://blog.github.com/2016-02-22-delivering-octicons-with-svg/) from font icons to SVG icons.
9 changes: 8 additions & 1 deletion packages/material-ui/src/FormHelperText/FormHelperText.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ export interface FormHelperTextProps
required?: boolean;
}

export type FormHelperTextClassKey = 'root' | 'error' | 'disabled' | 'marginDense' | 'focused' | 'filled' | 'required';
export type FormHelperTextClassKey =
| 'root'
| 'error'
| 'disabled'
| 'marginDense'
| 'focused'
| 'filled'
| 'required';

declare const FormHelperText: React.ComponentType<FormHelperTextProps>;

Expand Down
9 changes: 8 additions & 1 deletion packages/material-ui/src/FormLabel/FormLabel.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ export interface FormLabelProps extends StandardProps<FormLabelBaseProps, FormLa

export type FormLabelBaseProps = React.LabelHTMLAttributes<HTMLLabelElement>;

export type FormLabelClassKey = 'root' | 'focused' | 'disabled' | 'error' | 'filled' | 'required' | 'asterisk';
export type FormLabelClassKey =
| 'root'
| 'focused'
| 'disabled'
| 'error'
| 'filled'
| 'required'
| 'asterisk';

declare const FormLabel: React.ComponentType<FormLabelProps>;

Expand Down
14 changes: 8 additions & 6 deletions packages/material-ui/src/Popper/Popper.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ export type PopperPlacementType =
export interface PopperProps extends React.HTMLAttributes<HTMLDivElement> {
transition?: boolean;
anchorEl?: null | HTMLElement | ReferenceObject | ((element: HTMLElement) => HTMLElement);
children: React.ReactNode | ((
props: {
placement: PopperPlacementType;
TransitionProps?: TransitionProps;
},
) => React.ReactNode);
children:
| React.ReactNode
| ((
props: {
placement: PopperPlacementType;
TransitionProps?: TransitionProps;
},
) => React.ReactNode);
container?: PortalProps['container'];
disablePortal?: PortalProps['disablePortal'];
keepMounted?: boolean;
Expand Down
3 changes: 1 addition & 2 deletions packages/material-ui/src/styles/createTypography.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export default function createTypography(palette: Object, typography: Object | F
// Apply the CSS properties to all the variants.
allVariants,
...other
} =
typeof typography === 'function' ? typography(palette) : typography;
} = typeof typography === 'function' ? typography(palette) : typography;

const coef = fontSize / 14;
function pxToRem(value) {
Expand Down
Loading

0 comments on commit 49a74ad

Please sign in to comment.