From 084923da326e549b48e12a08662308db13ce416c Mon Sep 17 00:00:00 2001 From: Alex Meah Date: Sat, 14 Nov 2020 20:14:13 +0000 Subject: [PATCH] Add support for a custom className Allow better styling and support for libraries like TailwindCSS by allowing the user to specify `className`. It's not need for the placeholder as you can already supply a custom component. --- src/index.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.jsx b/src/index.jsx index c24d0ed..39c1505 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -333,12 +333,13 @@ class LazyLoad extends Component { height, children, placeholder, + className, classNamePrefix, style } = this.props; return ( -
+
{this.visible ? ( children ) : placeholder ? ( @@ -355,6 +356,7 @@ class LazyLoad extends Component { } LazyLoad.propTypes = { + className: PropTypes.string, classNamePrefix: PropTypes.string, once: PropTypes.bool, height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), @@ -375,6 +377,7 @@ LazyLoad.propTypes = { }; LazyLoad.defaultProps = { + className: '', classNamePrefix: 'lazyload', once: false, offset: 0,