Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions apps/website/pages/components/button/code.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Head from "next/head";
import type { ReactElement } from "react";
import ButtonPageLayout from "screens/components/button/ButtonPageLayout";
import ButtonCodePage from "screens/components/button/code/ButtonCodePage";

const Code = () => (
<>
<Head>
<title>Button Code — Halstack Design System</title>
</Head>
<ButtonCodePage />
</>
);

Code.getLayout = (page: ReactElement) => <ButtonPageLayout>{page}</ButtonPageLayout>;

export default Code;
24 changes: 10 additions & 14 deletions apps/website/pages/components/button/index.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
import Head from "next/head";
import type { ReactElement } from "react";
import ButtonPageLayout from "screens/components/button/ButtonPageLayout";
import ButtonCodePage from "screens/components/button/code/ButtonCodePage";
import ButtonOverviewPage from "screens/components/button/overview/ButtonOverviewPage";

const Index = () => {
return (
<>
<Head>
<title>Button — Halstack Design System</title>
</Head>
<ButtonCodePage></ButtonCodePage>
</>
);
};
const Index = () => (
<>
<Head>
<title>Button — Halstack Design System</title>
</Head>
<ButtonOverviewPage />
</>
);

Index.getLayout = function getLayout(page: ReactElement) {
return <ButtonPageLayout>{page}</ButtonPageLayout>;
};
Index.getLayout = (page: ReactElement) => <ButtonPageLayout>{page}</ButtonPageLayout>;

export default Index;
21 changes: 0 additions & 21 deletions apps/website/pages/components/button/specifications.tsx

This file was deleted.

21 changes: 0 additions & 21 deletions apps/website/pages/components/button/usage.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion apps/website/screens/common/QuickNavContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const getSubSectionsLinks = (sections: SectionType[]) => {
return linksList;
};

const DxcQuickNavContainer = ({ title, sections, startHeadingLevel = 1 }: QuickNavContainerTypes): JSX.Element => (
const DxcQuickNavContainer = ({ title = "On this page", sections, startHeadingLevel = 1 }: QuickNavContainerTypes): JSX.Element => (
<MainContainer>
<DxcGrid gap="3rem" templateColumns={["minmax(0, 1fr)"]}>
{sections.map((section) => (
Expand Down
12 changes: 4 additions & 8 deletions apps/website/screens/components/button/ButtonPageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import { ReactNode } from "react";

const ButtonPageHeading = ({ children }: { children: ReactNode }) => {
const tabs = [
{ label: "Code", path: "/components/button" },
{ label: "Usage", path: "/components/button/usage" },
{ label: "Specifications", path: "/components/button/specifications" },
{ label: "Overview", path: "/components/button" },
{ label: "Code", path: "/components/button/code" },
];

return (
Expand All @@ -18,12 +17,9 @@ const ButtonPageHeading = ({ children }: { children: ReactNode }) => {
<ComponentHeading name="Button" />
<DxcParagraph>
Buttons are basic interface elements that initialize an action or function when the user interacts with
them. The appearance of the button should suggest the user takes an action that leads to different
scenarios. These elements that reinforce to the user the necessity to interact are called CTA (Call to
Action) components, which basically are designed to capture user attention and improve the user experience
within the application.
them.
</DxcParagraph>
<TabsPageHeading tabs={tabs}></TabsPageHeading>
<TabsPageHeading tabs={tabs} />
</DxcFlex>
</PageHeading>
{children}
Expand Down
155 changes: 71 additions & 84 deletions apps/website/screens/components/button/code/ButtonCodePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Code from "@/common/Code";
import DocFooter from "@/common/DocFooter";
import QuickNavContainer from "@/common/QuickNavContainer";
import QuickNavContainerLayout from "@/common/QuickNavContainerLayout";
import StatusBadge from "@/common/StatusBadge";
import Example from "@/common/example/Example";
import basicUsage from "./examples/basicUsage";
import semantic from "./examples/semantic";
Expand All @@ -26,63 +25,13 @@ const sections = [
</thead>
<tbody>
<tr>
<td>label</td>
<td>
<TableCode>string</TableCode>
</td>
<td>Text to be placed in the button.</td>
<td>-</td>
</tr>
<tr>
<td>mode</td>
<td>
<TableCode>'primary' | 'secondary' | 'tertiary'</TableCode>
</td>
<td>The available button modes.</td>
<td>
<TableCode>'primary'</TableCode>
</td>
</tr>
<tr>
<td>
<DxcFlex direction="column" gap="0.25rem" alignItems="baseline">
<StatusBadge status="new" />
semantic
</DxcFlex>
</td>
<td>
<TableCode>'default' | 'error' | 'warning' | 'success' | 'info'</TableCode>
</td>
<td>Specifies the semantic meaning of the buttons, which determines its color.</td>
<td>
<TableCode>'default'</TableCode>
</td>
</tr>
<tr>
<td>title</td>
<td>
<TableCode>string</TableCode>
</td>
<td>
Text representing advisory information related to the button's action. Under the hood, this prop also
serves as an accessible label for the component.
</td>
<td>-</td>
</tr>
<tr>
<td>type</td>
<td>
<TableCode>'button' | 'reset' | 'submit'</TableCode>
</td>
<td>disabled</td>
<td>
Sets the <Code>type</Code> attribute of the <abbr>HTML</abbr> button element. See{" "}
<DxcLink newWindow href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes">
MDN
</DxcLink>{" "}
for further information.
<TableCode>boolean</TableCode>
</td>
<td>If true, the component will be disabled.</td>
<td>
<TableCode>'button'</TableCode>
<TableCode>false</TableCode>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -111,13 +60,32 @@ const sections = [
</td>
</tr>
<tr>
<td>disabled</td>
<td>label</td>
<td>
<TableCode>boolean</TableCode>
<TableCode>string</TableCode>
</td>
<td>If true, the component will be disabled.</td>
<td>Text to be placed in the button.</td>
<td>-</td>
</tr>
<tr>
<td>margin</td>
<td>
<TableCode>false</TableCode>
<TableCode>'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' | Margin</TableCode>
</td>
<td>
Size of the margin to be applied to the component. You can pass an object with 'top', 'bottom', 'left' and
'right' properties in order to specify different margin sizes.
</td>
<td>-</td>
</tr>
<tr>
<td>mode</td>
<td>
<TableCode>'primary' | 'secondary' | 'tertiary'</TableCode>
</td>
<td>The available button modes.</td>
<td>
<TableCode>'primary'</TableCode>
</td>
</tr>
<tr>
Expand All @@ -129,23 +97,17 @@ const sections = [
<td>-</td>
</tr>
<tr>
<td>margin</td>
<td>semantic</td>
<td>
<TableCode>'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' | Margin</TableCode>
<TableCode>'default' | 'error' | 'warning' | 'success' | 'info'</TableCode>
</td>
<td>Specifies the semantic meaning of the buttons, which determines its color.</td>
<td>
Size of the margin to be applied to the component. You can pass an object with 'top', 'bottom', 'left' and
'right' properties in order to specify different margin sizes.
<TableCode>'default'</TableCode>
</td>
<td>-</td>
</tr>
<tr>
<td>
<DxcFlex direction="column" gap="0.25rem" alignItems="baseline">
<StatusBadge status="new" />
size
</DxcFlex>
</td>
<td>size</td>
<td>
<TableCode>
{
Expand All @@ -170,6 +132,33 @@ const sections = [
<TableCode>0</TableCode>
</td>
</tr>
<tr>
<td>title</td>
<td>
<TableCode>string</TableCode>
</td>
<td>
Text representing advisory information related to the button's action. Under the hood, this prop also
serves as an accessible label for the component.
</td>
<td>-</td>
</tr>
<tr>
<td>type</td>
<td>
<TableCode>'button' | 'reset' | 'submit'</TableCode>
</td>
<td>
Sets the <Code>type</Code> attribute of the <abbr>HTML</abbr> button element. See{" "}
<DxcLink newWindow href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes">
MDN
</DxcLink>{" "}
for further information.
</td>
<td>
<TableCode>'button'</TableCode>
</td>
</tr>
</tbody>
</DxcTable>
),
Expand All @@ -181,14 +170,14 @@ const sections = [
title: "Basic usage",
content: <Example example={basicUsage} defaultIsVisible />,
},
{
title: "Semantic",
content: <Example example={semantic} defaultIsVisible />,
},
{
title: "Icons",
content: <Example example={icons} defaultIsVisible />,
},
{
title: "Semantic",
content: <Example example={semantic} defaultIsVisible />,
},
{
title: "Size",
content: <Example example={sizes} defaultIsVisible />,
Expand All @@ -197,15 +186,13 @@ const sections = [
},
];

const ButtonCodePage = () => {
return (
<DxcFlex direction="column" gap="4rem">
<QuickNavContainerLayout>
<QuickNavContainer sections={sections} startHeadingLevel={2}></QuickNavContainer>
</QuickNavContainerLayout>
<DocFooter githubLink="https://github.com/dxc-technology/halstack-react/blob/master/apps/website/screens/components/button/code/ButtonCodePage.tsx" />
</DxcFlex>
);
};
const ButtonCodePage = () => (
<DxcFlex direction="column" gap="4rem">
<QuickNavContainerLayout>
<QuickNavContainer sections={sections} startHeadingLevel={2} />
</QuickNavContainerLayout>
<DocFooter githubLink="https://github.com/dxc-technology/halstack-react/blob/master/apps/website/screens/components/button/code/ButtonCodePage.tsx" />
</DxcFlex>
);

export default ButtonCodePage;
Loading