Skip to content

Commit 9bd0f04

Browse files
authored
Forms: Update dashboard styling for consistency (#45783)
1 parent 05e64d2 commit 9bd0f04

File tree

11 files changed

+94
-33
lines changed

11 files changed

+94
-33
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: changed
3+
4+
Updated dashboard styling for visual consistency - improved header, buttons, tabs, and color variables

projects/packages/forms/src/dashboard/components/create-form-button/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default function CreateFormButton( {
4848

4949
return (
5050
<Button
51-
__next40pxDefaultSize
51+
size="compact"
5252
variant={ variant }
5353
onClick={ onButtonClickHandler }
5454
icon={ plus }

projects/packages/forms/src/dashboard/components/empty-spam-button/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ const EmptySpamButton = ( {
122122
return (
123123
<>
124124
<Button
125-
__next40pxDefaultSize
125+
size="compact"
126126
accessibleWhenDisabled
127127
disabled={ isEmpty || isEmptying }
128128
icon={ trash }

projects/packages/forms/src/dashboard/components/empty-trash-button/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ const EmptyTrashButton = ( {
122122
return (
123123
<>
124124
<Button
125-
__next40pxDefaultSize
125+
size="compact"
126126
accessibleWhenDisabled
127127
disabled={ isEmpty || isEmptying }
128128
icon={ trash }

projects/packages/forms/src/dashboard/components/inbox-status-toggle/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import jetpackAnalytics from '@automattic/jetpack-analytics';
55
import { useBreakpointMatch } from '@automattic/jetpack-components';
66
import { formatNumberCompact } from '@automattic/number-formatters';
7+
import { Badge } from '@automattic/ui';
78
import { __, _x } from '@wordpress/i18n';
89
import { useCallback } from 'react';
910
import { useSearchParams } from 'react-router';
@@ -22,10 +23,10 @@ import * as Tabs from '../tabs';
2223
*/
2324
function getTabLabel( label: string, count: number ): JSX.Element {
2425
return (
25-
<>
26+
<span style={ { display: 'flex', gap: '4px', alignItems: 'center' } }>
2627
{ label }
27-
<span className="jp-forms__inbox-status-count">{ formatNumberCompact( count || 0 ) }</span>
28-
</>
28+
<Badge variant="muted">{ formatNumberCompact( count || 0 ) }</Badge>
29+
</span>
2930
);
3031
}
3132

projects/packages/forms/src/dashboard/components/integrations-button/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function IntegrationsButton(): JSX.Element {
2323
}, [ navigate ] );
2424

2525
return (
26-
<Button __next40pxDefaultSize variant="secondary" onClick={ onButtonClickHandler }>
26+
<Button size="compact" variant="secondary" onClick={ onButtonClickHandler }>
2727
{ __( 'Integrations', 'jetpack-forms' ) }
2828
</Button>
2929
);
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/**
2+
* WordPress dependencies
3+
*/
4+
5+
import {
6+
__experimentalHeading as Heading, // eslint-disable-line @wordpress/no-unsafe-wp-apis
7+
__experimentalHStack as HStack, // eslint-disable-line @wordpress/no-unsafe-wp-apis
8+
__experimentalVStack as VStack, // eslint-disable-line @wordpress/no-unsafe-wp-apis
9+
} from '@wordpress/components';
10+
11+
/**
12+
* Custom header component for Forms dashboard with consistent styling.
13+
*
14+
* @param {object} props - Component props.
15+
* @param {React.ReactNode} props.title - The header title content.
16+
* @param {React.ReactNode} props.subTitle - The header subtitle/description.
17+
* @param {React.ReactNode} props.actions - Action buttons to display in the header.
18+
* @return {JSX.Element} The header component.
19+
*/
20+
export default function Header( {
21+
title,
22+
subTitle,
23+
actions,
24+
}: {
25+
title?: React.ReactNode;
26+
subTitle: React.ReactNode;
27+
actions?: React.ReactNode;
28+
} ) {
29+
return (
30+
<VStack className="admin-ui-page__header" as="header" spacing={ 0 }>
31+
<HStack className="admin-ui-page__header-title" justify="space-between" spacing={ 2 }>
32+
<HStack spacing={ 2 }>
33+
{ title && (
34+
<Heading level={ 1 } size="15px" lineHeight="32px" truncate>
35+
{ title }
36+
</Heading>
37+
) }
38+
</HStack>
39+
<HStack
40+
style={ { width: 'auto', flexShrink: 0 } }
41+
spacing={ 2 }
42+
className="admin-ui-page__header-actions"
43+
>
44+
{ actions }
45+
</HStack>
46+
</HStack>
47+
{ subTitle && <p className="admin-ui-page__header-subtitle">{ subTitle }</p> }
48+
</VStack>
49+
);
50+
}

projects/packages/forms/src/dashboard/components/layout/index.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { store as dashboardStore } from '../../store';
2020
import ActionsDropdownMenu from '../actions-dropdown-menu';
2121
import CreateFormButton from '../create-form-button';
2222
import IntegrationsButton from '../integrations-button';
23+
import Header from './header';
2324

2425
import './style.scss';
2526
// eslint-disable-next-line import/no-unresolved -- aliased to the package's built asset in webpack config.
@@ -69,16 +70,19 @@ const Layout = () => {
6970
);
7071

7172
return (
72-
<Page
73-
className="jp-forms__layout"
74-
title={
75-
<div className="jp-forms__layout-header-title">
76-
<JetpackLogo showText={ false } width={ 24 } /> Forms
77-
</div>
78-
}
79-
subTitle={ __( 'View and manage all your form submissions in one place.', 'jetpack-forms' ) }
80-
actions={ headerActions }
81-
>
73+
<Page className="jp-forms__layout">
74+
<Header
75+
title={
76+
<div className="jp-forms__layout-header-title">
77+
<JetpackLogo showText={ false } width={ 24 } /> Forms
78+
</div>
79+
}
80+
subTitle={ __(
81+
'View and manage all your form submissions in one place.',
82+
'jetpack-forms'
83+
) }
84+
actions={ headerActions }
85+
/>
8286
<NavigableRegion
8387
className="admin-ui-page__content"
8488
ariaLabel={ __( 'Forms dashboard content', 'jetpack-forms' ) }

projects/packages/forms/src/dashboard/components/layout/style.scss

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ body.jetpack_page_jetpack-forms-admin {
2323
padding: 0;
2424
width: 100%;
2525
min-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px));
26+
background: var(--wpds-color-bg-surface-neutral-strong, #fff);
27+
color: var(--wpds-color-fg-content-neutral, #1e1e1e);
2628

2729
.jp-forms__layout-header-title {
2830
display: flex;
@@ -42,14 +44,13 @@ body.jetpack_page_jetpack-forms-admin {
4244
}
4345

4446
#jp-forms-dashboard .jp-forms__layout {
45-
background: #fff;
4647

4748
.admin-ui-page__content {
4849
display: flex;
4950
flex: 1 1 auto;
5051
flex-direction: column;
5152
min-height: 0;
52-
background: var(--jp-white);
53+
background: var(--wpds-color-bg-surface-neutral-strong, #fff);
5354

5455
// Ensure Outlet renders as flex child that expands
5556
> * {
@@ -68,14 +69,21 @@ body.jetpack_page_jetpack-forms-admin {
6869
.admin-ui-page__header {
6970
box-sizing: border-box;
7071
margin: 0;
71-
padding: 16px 48px 4px;
72+
padding: 8px 20px;
7273
width: 100%;
73-
background: transparent;
74+
background: var(--wpds-color-bg-surface-neutral-strong, #fff);
75+
border-bottom: none;
7476

7577
@media (max-width: 782px) {
76-
padding: 8px 24px 0;
78+
padding: 12px 24px;
7779
}
7880
}
7981

82+
.admin-ui-page__header-subtitle {
83+
color: var(--wpds-color-fg-content-neutral-weak, #757575);
84+
margin: 0;
85+
padding-block-end: 8px;
86+
}
87+
8088

8189
}

projects/packages/forms/src/dashboard/inbox/export-responses/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const ExportResponsesButton = () => {
2828

2929
return (
3030
<>
31-
<Button __next40pxDefaultSize variant="primary" icon={ download } onClick={ openModal }>
31+
<Button size="compact" variant="primary" icon={ download } onClick={ openModal }>
3232
{ exportLabel }
3333
</Button>
3434

0 commit comments

Comments
 (0)