1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-12-25 00:11:36 +01:00

Add className to SpinnerElement.

This commit is contained in:
Bogdan Bodnar 2019-12-06 11:31:43 +01:00
parent 5bb298270b
commit aac6c6bf2a
No known key found for this signature in database
GPG Key ID: 49E4169AD3CA42B0
2 changed files with 10 additions and 11 deletions

View File

@ -46,6 +46,8 @@ export function Spinner({
SpinnerElement.propTypes = {
/** Spinner's size */
small: PropTypes.bool,
/** Additional className */
className: PropTypes.string,
/** Children components */
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
@ -53,13 +55,16 @@ SpinnerElement.propTypes = {
]),
};
export function SpinnerElement({ small, children }) {
export function SpinnerElement({ small, className, children }) {
return (
<>
<div className={`spinner-border ${small ? "spinner-border-sm" : ""}`} role="status">
<div
className={`spinner-border ${small ? "spinner-border-sm" : ""} ${className || ""}`.trim()}
role="status"
>
<span className="sr-only" />
</div>
<div className="spinner-text">{children}</div>
{children && <div className="spinner-text">{children}</div>}
</>
);
}

View File

@ -33,9 +33,6 @@ exports[`conditional HOCs withSpinner should render spinner 1`] = `
class="sr-only"
/>
</div>
<div
class="spinner-text"
/>
</div>
</div>
`;
@ -53,9 +50,6 @@ exports[`conditional HOCs withSpinnerOnSending should render spinner 1`] = `
class="sr-only"
/>
</div>
<div
class="spinner-text"
/>
</div>
</div>
`;