Skip to content

Commit 8ce69e4

Browse files
Merge pull request #2356 from dxc-technology/jialecl/appLayout-logo
Logo prop moved to the application layout
2 parents a88c0fe + 436a0dc commit 8ce69e4

24 files changed

+233
-320
lines changed

apps/website/pages/_app.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ export default function App({ Component, pageProps, emotionCache = clientSideEmo
8888
const navItems: Section[] = useMemo(() => {
8989
return LinksSections.map((section) => {
9090
const baseItems = normalizeNavTabs(section.links);
91-
9291
const items = filter ? filterNavTree(baseItems, filter.trim().toLowerCase()) : baseItems;
93-
9492
return {
9593
title: section.label,
9694
items,
@@ -104,11 +102,12 @@ export default function App({ Component, pageProps, emotionCache = clientSideEmo
104102
<link rel="icon" type="image/png" sizes="32x32" href="/favicon.png" />
105103
</Head>
106104
<DxcApplicationLayout
107-
header={<DxcApplicationLayout.Header logo={{ src: dxcLogo, alt: "DXC Technology" }} />}
105+
logo={{ src: dxcLogo, alt: "DXC Technology" }}
106+
header={<DxcApplicationLayout.Header />}
108107
sidenav={
109108
<DxcApplicationLayout.Sidenav
110109
navItems={navItems}
111-
branding={isExpanded && <SidenavLogo />}
110+
appTitle={isExpanded && <SidenavLogo />}
112111
topContent={
113112
isExpanded && (
114113
<DxcTextInput

apps/website/screens/common/componentsList.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,16 @@
33
{ "label": "Alert", "path": "/components/alert", "status": "stable" },
44
{
55
"label": "Application layout",
6-
"path": "/components/application-layout",
7-
"status": "stable"
6+
"links": [
7+
{
8+
"label": "Application layout",
9+
"path": "/components/application-layout",
10+
"status": "stable"
11+
},
12+
{ "label": "Footer", "path": "/components/footer", "status": "stable" },
13+
{ "label": "Header", "path": "/components/header", "status": "stable" },
14+
{ "label": "Sidenav", "path": "/components/sidenav", "status": "stable" }
15+
]
816
},
917
{
1018
"label": "Avatar",
@@ -64,9 +72,7 @@
6472
"status": "stable"
6573
},
6674
{ "label": "Flex", "path": "/components/flex", "status": "stable" },
67-
{ "label": "Footer", "path": "/components/footer", "status": "stable" },
6875
{ "label": "Grid", "path": "/components/grid", "status": "stable" },
69-
{ "label": "Header", "path": "/components/header", "status": "stable" },
7076
{ "label": "Heading", "path": "/components/heading", "status": "stable" },
7177
{ "label": "Image", "path": "/components/image", "status": "stable" },
7278
{ "label": "Inset", "path": "/components/inset", "status": "stable" },
@@ -101,7 +107,6 @@
101107
"status": "stable"
102108
},
103109
{ "label": "Select", "path": "/components/select", "status": "stable" },
104-
{ "label": "Sidenav", "path": "/components/sidenav", "status": "stable" },
105110
{ "label": "Slider", "path": "/components/slider", "status": "stable" },
106111
{ "label": "Spinner", "path": "/components/spinner", "status": "stable" },
107112
{

apps/website/screens/common/pagesList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const v16Links: LinkDetails[] = [
6262

6363
const migrationLinks: LinksSectionDetails[] = [{ label: "v16", links: v16Links }];
6464

65-
const componentsLinks = componentsList as LinkDetails[];
65+
const componentsLinks = componentsList as (LinkDetails | LinksSectionDetails)[];
6666

6767
export const LinksSections: LinksSectionDetails[] = [
6868
{ label: "Overview", links: overviewLinks },

apps/website/screens/components/application-layout/code/ApplicationLayoutCodePage.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@ import { DxcParagraph, DxcFlex, DxcTable, DxcLink } from "@dxc-technology/halsta
22
import DocFooter from "@/common/DocFooter";
33
import QuickNavContainer from "@/common/QuickNavContainer";
44
import Link from "next/link";
5-
import Code, { TableCode } from "@/common/Code";
5+
import Code, { ExtendedTableCode, TableCode } from "@/common/Code";
66
import StatusBadge from "@/common/StatusBadge";
77

8+
const logoTypeString = `{
9+
src: string | SVG;
10+
alt: string;
11+
href?: string;
12+
onClick?: () => void;
13+
}`;
14+
815
const ApplicationLayoutPropsTable = () => (
916
<DxcTable>
1017
<thead>
@@ -61,6 +68,22 @@ const ApplicationLayoutPropsTable = () => (
6168
</td>
6269
<td>-</td>
6370
</tr>
71+
<tr>
72+
<td>
73+
<DxcFlex direction="column" gap="var(--spacing-gap-xs)" alignItems="baseline">
74+
<StatusBadge status="new" />
75+
logo
76+
</DxcFlex>
77+
</td>
78+
<td>
79+
<ExtendedTableCode>{logoTypeString}</ExtendedTableCode>
80+
</td>
81+
<td>
82+
Object used to configure the header logo. The logo will be placed in the header, but if no global app header
83+
exists, it will be shown in the sidenav instead.
84+
</td>
85+
<td>-</td>
86+
</tr>
6487
<tr>
6588
<td>sidenav</td>
6689
<td>

apps/website/screens/components/header/code/HeaderCodePage.tsx

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ import { DxcFlex, DxcTable } from "@dxc-technology/halstack-react";
22
import DocFooter from "@/common/DocFooter";
33
import QuickNavContainer from "@/common/QuickNavContainer";
44
import Code, { ExtendedTableCode, TableCode } from "@/common/Code";
5-
import StatusBadge from "@/common/StatusBadge";
6-
7-
const logoTypeString = `{
8-
src: string | SVG;
9-
alt: string;
10-
href?: string;
11-
onClick?: () => void;
12-
}`;
135

146
const navItemsTypeString = `(GroupItem | Item)[]`;
157

@@ -50,19 +42,6 @@ const sections = [
5042
<td>Object used to configure the header application title.</td>
5143
<td>-</td>
5244
</tr>
53-
<tr>
54-
<td>
55-
<DxcFlex direction="column" gap="var(--spacing-gap-xs)" alignItems="baseline">
56-
<StatusBadge status="required" />
57-
logo
58-
</DxcFlex>
59-
</td>
60-
<td>
61-
<ExtendedTableCode>{logoTypeString}</ExtendedTableCode>
62-
</td>
63-
<td>Object used to configure the header logo.</td>
64-
<td>-</td>
65-
</tr>
6645
<tr>
6746
<td>navItems</td>
6847
<td>

apps/website/screens/components/header/overview/HeaderOverviewPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const sections = [
3737
{/* It is also where the searchbar will be displayed once that feature is triggered. */}
3838
</DxcBulletedList.Item>
3939
<DxcBulletedList.Item>
40-
<strong>Right slot:</strong> it's the place where all utilities related to an application are hosted. Its
40+
<strong>Right slot:</strong> it's the place where all utilities related to an application are hosted. It's
4141
highly adaptable for each product's needs.
4242
</DxcBulletedList.Item>
4343
</DxcBulletedList>

apps/website/screens/components/sidenav/code/SidenavCodePage.tsx

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,6 @@ import Code, { ExtendedTableCode, TableCode } from "@/common/Code";
44
import { DxcFlex, DxcTable } from "@dxc-technology/halstack-react";
55
import StatusBadge from "@/common/StatusBadge";
66

7-
const brandingTypeString = `{
8-
logo?: Logo;
9-
appTitle?: string;
10-
}`;
11-
12-
const logoTypeString = `{
13-
alt: string;
14-
href?: string;
15-
onClick?: (event: MouseEvent<HTMLDivElement>) => void;
16-
src: string;
17-
}`;
18-
197
const commonItemTypeString = `badge?: ReactElement;
208
icon?: string | SVG;
219
label: string;`;
@@ -63,27 +51,6 @@ const sections = [
6351
<td>The content rendered in the bottom part of the sidenav, under the navigation menu.</td>
6452
<td>-</td>
6553
</tr>
66-
<tr>
67-
<td>
68-
<DxcFlex direction="column" gap="var(--spacing-gap-xs)" alignItems="baseline">
69-
<StatusBadge status="new" />
70-
branding
71-
</DxcFlex>
72-
</td>
73-
<td>
74-
<TableCode>{"Branding | ReactNode"}</TableCode>
75-
<p>
76-
being <Code>Branding</Code> an object with the following properties:
77-
</p>
78-
<ExtendedTableCode>{brandingTypeString}</ExtendedTableCode>
79-
<p>
80-
and <Code>Logo</Code> an object with the following properties:
81-
</p>
82-
<ExtendedTableCode>{logoTypeString}</ExtendedTableCode>
83-
</td>
84-
<td>Object with the properties of the branding placed at the top of the sidenav.</td>
85-
<td>-</td>
86-
</tr>
8754
<tr>
8855
<td>
8956
<DxcFlex direction="column" gap="var(--spacing-gap-xs)" alignItems="baseline">

apps/website/screens/components/sidenav/overview/SidenavOverviewPage.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ const sections = [
4040
Contains <strong>collapse/expand toggle</strong> for the sidenav.
4141
</DxcBulletedList.Item>
4242
<DxcBulletedList.Item>
43-
If no global app header exists, this area should be used for <strong>branding</strong> (logo,
44-
product/app name).
43+
If no global app header exists, this area will be used for <strong>logo and application name</strong>.
4544
</DxcBulletedList.Item>
4645
</DxcBulletedList>
4746
</DxcBulletedList.Item>

packages/lib/src/footer/Footer.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,9 @@ const items = [
468468

469469
const FooterInLayout = () => (
470470
<DxcApplicationLayout
471+
logo={dxcBrandedLogo}
471472
header={
472473
<DxcHeader
473-
logo={dxcBrandedLogo}
474474
navItems={items}
475475
sideContent={(isResponsive) =>
476476
isResponsive ? (
@@ -546,9 +546,9 @@ const FooterInLayout = () => (
546546

547547
const ReducedFooterInLayout = () => (
548548
<DxcApplicationLayout
549+
logo={dxcBrandedLogo}
549550
header={
550551
<DxcHeader
551-
logo={dxcBrandedLogo}
552552
navItems={items}
553553
sideContent={(isResponsive) =>
554554
isResponsive ? (

packages/lib/src/header/Header.accessibility.test.tsx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,6 @@ const disabledRules = {
1616
rules: formatRules(rules),
1717
};
1818

19-
const iconSVG = (
20-
<svg viewBox="0 0 24 24" height="24" width="24" fill="currentColor">
21-
<path d="M0 0h24v24H0z" fill="none" />
22-
<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" />
23-
</svg>
24-
);
25-
26-
const iconUrl = "https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png";
27-
28-
const logo = {
29-
src: iconSVG,
30-
alt: "DXC Logo",
31-
href: iconUrl,
32-
};
3319
const appTitle =
3420
"Application Title with a very long name that exceeds the normal length to test how the header manages overflow situations";
3521

@@ -71,7 +57,6 @@ describe("Header component accessibility tests", () => {
7157
it("Should not have basic accessibility issues", async () => {
7258
const { container } = render(
7359
<DxcHeader
74-
logo={logo}
7560
appTitle={appTitle}
7661
navItems={items}
7762
sideContent={

0 commit comments

Comments
 (0)