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