2025-12-11 10:40:55 +01:00
|
|
|
/*
|
2026-01-12 15:00:36 +01:00
|
|
|
* Copyright (c) 2026 by Christian Kellner.
|
2025-12-11 10:40:55 +01:00
|
|
|
* Licensed under Apache-2.0 with Commons Clause and Attribution/Naming Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2021-01-21 16:09:23 +01:00
|
|
|
import './Placeholder.less';
|
|
|
|
|
|
|
|
|
|
function getPlaceholder(rowCount, className) {
|
|
|
|
|
const rows = [];
|
|
|
|
|
for (let i = 0; i < rowCount; i++) {
|
|
|
|
|
rows.push(<div className="place__line" key={i} />);
|
|
|
|
|
}
|
|
|
|
|
const clazz = `place ${className == null ? '' : className}`;
|
|
|
|
|
return (
|
|
|
|
|
<div className={clazz}>
|
|
|
|
|
<div className="place__circle" />
|
|
|
|
|
<div className="place__place_lines_wrapper">{rows}</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default function Placeholder({ rows = 3, ready = false, children, customPlaceholder, className }) {
|
|
|
|
|
if (!ready) {
|
|
|
|
|
if (customPlaceholder != null) {
|
|
|
|
|
return customPlaceholder;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return getPlaceholder(rows, className);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return children;
|
|
|
|
|
}
|