Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

💄 style(acceptance): align the detail header with the checklist width (#22588)

Arvin Xuf44449bfd429
diff --git a/src/features/Acceptance/Viewer/AcceptanceOverview.tsx b/src/features/Acceptance/Viewer/AcceptanceOverview.tsx
index c81cbecfcbf..a7601b17454 100644
--- a/src/features/Acceptance/Viewer/AcceptanceOverview.tsx
+++ b/src/features/Acceptance/Viewer/AcceptanceOverview.tsx
@@ -26,7 +26,11 @@ import AcceptanceShare from './Header/AcceptanceShare';
import AcceptanceStatusControl from './Header/AcceptanceStatusControl';
import type { AcceptanceTabKey } from './Header/AcceptanceTabs';
import AcceptanceTabs from './Header/AcceptanceTabs';
-import { acceptanceChecksLayout, acceptanceContentLayout } from './layout';
+import {
+ acceptanceContentLayout,
+ acceptanceReadingColumnMaxWidth,
+ getAcceptanceBodyMaxWidth,
+} from './layout';
import { flowPlanPhase } from './Plan/planReview';
import AcceptanceDecision from './Review/AcceptanceDecision';
import { AcceptanceRepair } from './Review/AcceptanceRepair';
@@ -45,11 +49,6 @@ const styles = createStaticStyles(({ css }) => ({
padding-inline: 16px;
}
`,
- checks: css`
- width: 100%;
- max-width: ${acceptanceChecksLayout.maxWidth}px;
- margin-inline: auto;
- `,
headerBand: css`
flex: none;
padding-block: 20px 0;
@@ -100,7 +99,11 @@ export const AcceptanceOverview = ({
return (
<>
<Flexbox className={styles.headerBand}>
- <Flexbox className={styles.column} gap={12}>
+ <Flexbox
+ className={styles.column}
+ gap={12}
+ style={{ maxWidth: acceptanceReadingColumnMaxWidth }}
+ >
{/* Sharing sits beside the identity, as on the workbench page. The
control gates itself on the server's review capability, so a
reader without it sees nothing here. The inline padding clears the
@@ -152,7 +155,7 @@ export const AcceptanceOverview = ({
className={styles.column}
gap={16}
paddingBlock={20}
- style={tab === 'flow' ? { maxWidth: 1500 } : undefined}
+ style={{ maxWidth: tab === 'flow' ? 1500 : getAcceptanceBodyMaxWidth(tab) }}
>
{/* Deciding belongs where the evidence is. The discussion is a
conversation; ending one there put the closing act under a thread
@@ -170,11 +173,11 @@ export const AcceptanceOverview = ({
) : tab === 'checks' && gateDossier ? (
<GateReview dossier={gateDossier} />
) : tab === 'checks' ? (
- <Flexbox className={styles.checks} gap={16}>
+ <>
<AcceptanceCheckInventory toolbar={<AcceptanceCheckOwnerToolbar />} />
<ReviewerApprovalBar />
<AcceptanceDecision onDraftToComposer={onDraftToComposer} />
- </Flexbox>
+ </>
) : (
<AcceptanceResources />
)}
diff --git a/src/features/Acceptance/Viewer/layout.test.ts b/src/features/Acceptance/Viewer/layout.test.ts
index 4d49ddc61e6..e283b106958 100644
--- a/src/features/Acceptance/Viewer/layout.test.ts
+++ b/src/features/Acceptance/Viewer/layout.test.ts
@@ -4,9 +4,27 @@ import {
acceptanceChecksLayout,
acceptanceContentLayout,
acceptanceFocusedLayout,
+ acceptanceReadingColumnMaxWidth,
acceptanceScrollLayout,
+ getAcceptanceBodyMaxWidth,
} from './layout';
+describe('acceptance column widths', () => {
+ it('fits the header to the checklist width', () => {
+ expect(acceptanceReadingColumnMaxWidth - 2 * acceptanceContentLayout.paddingInline).toBe(
+ acceptanceChecksLayout.maxWidth,
+ );
+ });
+
+ it('gives the wide frame to the discussion body only', () => {
+ expect(getAcceptanceBodyMaxWidth('discussion')).toBe(acceptanceContentLayout.maxWidth);
+ });
+
+ it.each(['checks', 'resources'])('keeps the %s body at the header width', (tab) => {
+ expect(getAcceptanceBodyMaxWidth(tab)).toBe(acceptanceReadingColumnMaxWidth);
+ });
+});
+
describe('acceptanceChecksLayout', () => {
it('keeps the checklist narrower than the discussion frame', () => {
expect(acceptanceChecksLayout.maxWidth).toBe(920);
diff --git a/src/features/Acceptance/Viewer/layout.ts b/src/features/Acceptance/Viewer/layout.ts
index a34b06207eb..d359889d6fa 100644
--- a/src/features/Acceptance/Viewer/layout.ts
+++ b/src/features/Acceptance/Viewer/layout.ts
@@ -11,6 +11,16 @@ export const acceptanceChecksLayout = {
maxWidth: 920,
} as const;
+/** The checklist's measure with the column's own padding added back, so the
+ * content inside lands on exactly that width. The header always uses it: the
+ * title and tabs must stay put when the reader switches tabs. */
+export const acceptanceReadingColumnMaxWidth =
+ acceptanceChecksLayout.maxWidth + 2 * acceptanceContentLayout.paddingInline;
+
+/** Only the discussion has an aside to make room for. */
+export const getAcceptanceBodyMaxWidth = (tab: string) =>
+ tab === 'discussion' ? acceptanceContentLayout.maxWidth : acceptanceReadingColumnMaxWidth;
+
export const acceptanceFocusedLayout = {
contentPaddingBlock: '32px 24px',
headerGap: 8,