trainline / react-skeletor

Skeleton loading for React
https://trainline.github.io/react-skeletor/
Other
554 stars 27 forks source link

What happen when a framework like material-ui is used? #10

Closed danyflorez closed 6 years ago

danyflorez commented 6 years ago

Hi,

I have been playing with your react-skeletor, it's a great solution btw, but what happen when there is not complete domain of the elements of the dom like in material-ui that has useful component? Can we still be able to use react-skeletor? How?

Thank you very much!

alex3165 commented 6 years ago

Hey @danyflorez, You can create a skeletonElement out of any React component, it doesn't need to be a primitive HTMLElement, although the component need to pass down the style or className prop to the dom element (which seems to be the case for material-ui). For example:

import Button from 'material-ui/Button';
import { createSkeletonElement } from '@trainline/react-skeletor';

const SkeletonButton = createSkeletonElement(Button, 'pending_css');

<SkeletonButton>My skeleton button</SkeletonButton>
danyflorez commented 6 years ago

@alex3165 Thank you!

alex3165 commented 6 years ago

@danyflorez No probs, let me know if you have any issue.