Skip to content

Commit 88af0e7

Browse files
committed
Merge branch 'PelayoFelgueroso/improve-migration_documentation' of https://github.com/dxc-technology/halstack-react into PelayoFelgueroso/improve-migration_documentation
2 parents e7023d1 + d633704 commit 88af0e7

File tree

5 files changed

+94
-2
lines changed

5 files changed

+94
-2
lines changed

apps/website/pages/migration/16/component-updates.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Head from "next/head";
2-
import Components16MigrationPage from "screens/migration/Components16MigrationPage";
2+
import Components16MigrationPage from "screens/migration/components/Components16MigrationPage";
33

44
const Components16Migration = () => (
55
<>

apps/website/screens/migration/TokensMigrationPage.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ const sections = [
6666
<li>Migrating color, spacing, and typography overrides to CSS tokens.</li>
6767
<li>Replacing any custom component overrides that referenced theme object values.</li>
6868
<li>Updating global styles to rely on CSS variables instead of hardcoded values.</li>
69+
<li>Refactoring prop values to rely on alias tokens instead of hardcoded values.</li>
6970
</ul>
7071
</>
7172
),
@@ -153,7 +154,8 @@ return (
153154
<DxcParagraph>
154155
This can be applied to colors, fonts, spacings and borders. However, keep in mind that, for now, only core
155156
tokens can be overwritten and they affect all the components which are wrapped within the{" "}
156-
<Code>HalstackProvider</Code>.
157+
<Code>HalstackProvider</Code>. Note that the former <Code>theme</Code> prop has been renamed to{" "}
158+
<Code>opinionatedTheme</Code>.
157159
</DxcParagraph>
158160
</>
159161
),

apps/website/screens/migration/Components16MigrationPage.tsx renamed to apps/website/screens/migration/components/Components16MigrationPage.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import DocFooter from "@/common/DocFooter";
44
import PageHeading from "@/common/PageHeading";
55
import Code, { ExtendedTableCode } from "@/common/Code";
66
import Link from "next/link";
7+
import Example from "@/common/example/Example";
8+
import previousExample from "./examples/previous";
9+
import newExample from "./examples/new";
710

811
const sections = [
912
{
@@ -16,6 +19,27 @@ const sections = [
1619
</DxcParagraph>
1720
),
1821
},
22+
{
23+
title: "Usage of components",
24+
content: (
25+
<>
26+
<DxcParagraph>
27+
In our component props, instead of passing hardcoded values such as <Code>2rem</Code>, we should always use an
28+
alias token whenever possible. Only if no suitable alias token exists, a core token or a hardcoded value may
29+
be used.
30+
</DxcParagraph>
31+
<DxcParagraph>Previous version:</DxcParagraph>
32+
<Example example={previousExample} defaultIsVisible />
33+
<Example example={newExample} defaultIsVisible />
34+
<DxcParagraph>
35+
For more information about tokens refer to{" "}
36+
<Link href="/foundations/tokens/overview" passHref legacyBehavior>
37+
<DxcLink>its documentation</DxcLink>
38+
</Link>
39+
</DxcParagraph>
40+
</>
41+
),
42+
},
1943
{
2044
title: "Added components",
2145
content: (
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { DxcContainer, DxcFlex, DxcInset } from "@dxc-technology/halstack-react";
2+
3+
const code = `() => {
4+
return (
5+
<DxcInset space="var(--spacing-padding-xl)">
6+
<DxcFlex gap="var(--spacing-gap-xl)">
7+
<DxcContainer
8+
width="100%"
9+
height="var(--height-xxl)"
10+
background={{color: "var(--color-bg-primary-medium)"}}
11+
/>
12+
<DxcContainer
13+
width="100%"
14+
height="var(--height-xxl)"
15+
background={{color: "var(--color-bg-primary-strong)"}}
16+
/>
17+
<DxcContainer
18+
width="100%"
19+
height="var(--height-xxl)"
20+
background={{color: "var(--color-bg-primary-medium)"}}
21+
/>
22+
</DxcFlex>
23+
</DxcInset>
24+
);
25+
}`;
26+
27+
const scope = {
28+
DxcFlex,
29+
DxcInset,
30+
DxcContainer,
31+
};
32+
33+
export default { code, scope };
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { DxcContainer, DxcFlex, DxcInset } from "@dxc-technology/halstack-react";
2+
3+
const code = `() => {
4+
return (
5+
<DxcInset space="2rem">
6+
<DxcFlex gap="2rem">
7+
<DxcContainer
8+
width="100%"
9+
height="40px"
10+
background={{color: "#DDC9F3"}}
11+
/>
12+
<DxcContainer
13+
width="100%"
14+
height="40px"
15+
background={{color: "#6F4B97"}}
16+
/>
17+
<DxcContainer
18+
width="100%"
19+
height="40px"
20+
background={{color: "#DDC9F3"}}
21+
/>
22+
</DxcFlex>
23+
</DxcInset>
24+
);
25+
}`;
26+
27+
const scope = {
28+
DxcFlex,
29+
DxcInset,
30+
DxcContainer,
31+
};
32+
33+
export default { code, scope };

0 commit comments

Comments
 (0)