1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-11-14 17:35:35 +01:00

Button: Fix loading state & button's layout

This commit is contained in:
Aleksandr Gumroian 2023-01-18 14:04:28 +01:00
parent 9c3dcaf6b5
commit d49ff0150c
No known key found for this signature in database
GPG Key ID: 9E77849C64F0A733
2 changed files with 19 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
* Copyright (C) 2019-2023 CZ.NIC z.s.p.o. (https://www.nic.cz/)
*
* This is free software, licensed under the GNU General Public License v3.
* See /LICENSE for more information.
@ -36,19 +36,20 @@ export function Button({
buttonClass = `${buttonClass} col-sm-12 col-md-3 col-lg-2`;
}
const span = loading ? (
return (
<button
type="button"
className={`${buttonClass} d-inline-flex justify-content-center align-items-center`}
{...props}
>
{loading && (
<span
className="spinner-border spinner-border-sm"
className="spinner-border spinner-border-sm mr-1"
role="status"
aria-hidden="true"
/>
) : null;
return (
<button type="button" className={buttonClass} {...props}>
{span}
{span ? " " : null}
{children}
)}
<span>{children}</span>
</button>
);
}

View File

@ -31,3 +31,7 @@
.spinner-fs-wrapper .spinner-text {
margin: 1rem;
}
.spinner-border-sm {
min-width: 16px;
}