diff options
Diffstat (limited to 'packages/ui/src/infobox/index.tsx')
-rw-r--r-- | packages/ui/src/infobox/index.tsx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/packages/ui/src/infobox/index.tsx b/packages/ui/src/infobox/index.tsx index 53ed16341..9066a623e 100644 --- a/packages/ui/src/infobox/index.tsx +++ b/packages/ui/src/infobox/index.tsx | |||
@@ -11,10 +11,12 @@ interface IProps extends IWithStyle { | |||
11 | type?: string; | 11 | type?: string; |
12 | dismissable?: boolean; | 12 | dismissable?: boolean; |
13 | onDismiss?: () => void; | 13 | onDismiss?: () => void; |
14 | onUnmount?: () => void; | ||
14 | ctaOnClick?: () => void; | 15 | ctaOnClick?: () => void; |
15 | ctaLabel?: string; | 16 | ctaLabel?: string; |
16 | ctaLoading?: boolean; | 17 | ctaLoading?: boolean; |
17 | children: React.ReactNode; | 18 | children: React.ReactNode; |
19 | className: string; | ||
18 | } | 20 | } |
19 | 21 | ||
20 | interface IState { | 22 | interface IState { |
@@ -45,6 +47,7 @@ const styles = (theme: Theme) => ({ | |||
45 | wrapper: { | 47 | wrapper: { |
46 | position: 'relative', | 48 | position: 'relative', |
47 | overflow: 'hidden', | 49 | overflow: 'hidden', |
50 | height: 'auto', | ||
48 | }, | 51 | }, |
49 | infobox: { | 52 | infobox: { |
50 | alignItems: 'center', | 53 | alignItems: 'center', |
@@ -128,6 +131,11 @@ class InfoboxComponent extends Component<IProps, IState> { | |||
128 | }, 3000); | 131 | }, 3000); |
129 | } | 132 | } |
130 | 133 | ||
134 | componentWillUnmount(): void { | ||
135 | const { onUnmount } = this.props; | ||
136 | if (onUnmount) onUnmount(); | ||
137 | } | ||
138 | |||
131 | render() { | 139 | render() { |
132 | const { | 140 | const { |
133 | classes, | 141 | classes, |
@@ -138,6 +146,7 @@ class InfoboxComponent extends Component<IProps, IState> { | |||
138 | ctaLoading, | 146 | ctaLoading, |
139 | ctaOnClick, | 147 | ctaOnClick, |
140 | dismissable, | 148 | dismissable, |
149 | className, | ||
141 | } = this.props; | 150 | } = this.props; |
142 | 151 | ||
143 | const { | 152 | const { |
@@ -150,7 +159,10 @@ class InfoboxComponent extends Component<IProps, IState> { | |||
150 | } | 159 | } |
151 | 160 | ||
152 | return ( | 161 | return ( |
153 | <div className={classes.wrapper}> | 162 | <div className={classnames({ |
163 | [classes.wrapper]: true, | ||
164 | [`${className}`]: className, | ||
165 | })}> | ||
154 | <div | 166 | <div |
155 | className={classnames({ | 167 | className={classnames({ |
156 | [classes.infobox]: true, | 168 | [classes.infobox]: true, |