Skip to content

Commit 9710203

Browse files
committed
feat(platform): add aLabelAlign prop to detail-view
1 parent f752d3f commit 9710203

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

packages/platform/src/app/components/detail-view/DetailView.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface AppDetailViewProps extends Omit<React.HTMLAttributes<HTMLDivEle
1111
}[];
1212
aCol?: number | true | Record<'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl', number | true>;
1313
aGutter?: number | [number?, number?];
14+
aLabelAlign?: 'left' | 'center' | 'right';
1415
aLabelWidth?: string | number;
1516
aEmpty?: React.ReactNode;
1617
aVertical?: boolean;
@@ -21,14 +22,15 @@ export function AppDetailView(props: AppDetailViewProps): JSX.Element | null {
2122
aList,
2223
aCol = { xs: 12, md: 6, lg: 4, xxl: 3 },
2324
aGutter,
25+
aLabelAlign = 'left',
2426
aLabelWidth,
2527
aEmpty = '-',
2628
aVertical = false,
2729

2830
...restProps
2931
} = props;
3032

31-
const [gutterX, gutterY] = isArray(aGutter) ? aGutter : [aGutter, aGutter];
33+
const [gutterY, gutterX] = isArray(aGutter) ? aGutter : [aGutter, aGutter];
3234
const col = (() => {
3335
if (aCol === true) {
3436
return 'col';
@@ -81,7 +83,13 @@ export function AppDetailView(props: AppDetailViewProps): JSX.Element | null {
8183
: _isEmpty;
8284
return (
8385
<div key={label} className={getClassName('app-detail-view__item', col)}>
84-
<div className="app-detail-view__item-label" style={{ width: labelWidth }}>
86+
<div
87+
className="app-detail-view__item-label"
88+
style={{
89+
width: labelWidth,
90+
textAlign: aLabelAlign,
91+
}}
92+
>
8593
{label}
8694
</div>
8795
<div className="app-detail-view__item-content">{isEmpty ? aEmpty : content}</div>

packages/platform/src/styles/components/detail-view.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
@include e(item) {
1515
display: inline-flex;
16-
gap: 8px;
16+
gap: 8px 12px;
1717
}
1818

1919
@include e(item-label) {
@@ -25,4 +25,8 @@
2525
content: ':';
2626
}
2727
}
28+
29+
@include e(item-content) {
30+
word-break: break-all;
31+
}
2832
}

0 commit comments

Comments
 (0)