增加附加标签组件中水平排列的功能。
This commit is contained in:
parent
8a55c73c83
commit
a56d473148
|
@ -5,12 +5,19 @@
|
|||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: var(--spacing-xs);
|
||||
&.inline {
|
||||
flex-direction: row;
|
||||
gap: var(--spacing-s);
|
||||
}
|
||||
label {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: baseline;
|
||||
font-size: var(--font-size-xs);
|
||||
.inline & {
|
||||
width: fit-content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
import cx from 'clsx';
|
||||
import styles from './Labeled.module.css';
|
||||
|
||||
type LabeledProps = {
|
||||
label: string;
|
||||
inline?: boolean;
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
export function Labeled({ label, children }: LabeledProps) {
|
||||
export function Labeled({ label, inline = false, children }: LabeledProps) {
|
||||
return (
|
||||
<div className={styles.labeled}>
|
||||
<div className={cx(styles.labeled, inline && styles.inline)}>
|
||||
<label>{label}</label>
|
||||
{children}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user