Skip to content

Commit

Permalink
PR review tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
Arianna Malakis committed Dec 18, 2024
1 parent 41b376d commit 44f8c57
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ const headingStyles = createStyles({
color: base.blackPepper400,
gridColumn: '2',
fontWeight: system.fontWeight.bold,
marginTop: system.space.zero,
marginBottom: system.space.zero,
});

export const Heading = createComponent('div')({
export const Heading = createComponent('h3')({
displayName: 'Heading',
Component: (props, ref, Element) => {
return <Base as={Element} ref={ref} cs={headingStyles} {...props} />;
Expand Down
6 changes: 3 additions & 3 deletions modules/preview-react/InformationHighlight/lib/parts/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import {ExternalHyperlink} from '@workday/canvas-kit-react/button';
import {Hyperlink} from '@workday/canvas-kit-react/button';
import {createComponent} from '@workday/canvas-kit-react/common';
import {createStyles, cssVar} from '@workday/canvas-kit-styling';
import {base, system} from '@workday/canvas-tokens-web';
Expand All @@ -12,9 +12,9 @@ const linkStyles = createStyles({
fontWeight: system.fontWeight.bold,
});

export const Link = createComponent('div')({
export const Link = createComponent('a')({
displayName: 'Link',
Component: (props, ref, Element) => {
return <ExternalHyperlink as={Element} ref={ref} className={linkStyles} {...props} />;
return <Hyperlink as={Element} ref={ref} className={linkStyles} {...props} />;
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,17 @@ It draws the user's attention and can emphasize importance.
### Attention
<ExampleCodeBlock code={AttentionHigh} />

## Partial Custom Information Highlights
## Right-to-Left (RTL) Support

`Information Highlights` can use custom icons or be designed to only use certain features
`Information Highlight` is compatible with right-to-left (RTL) languages. The layout will automatically adjust to RTL
if a custom theme with a direction of `ContentDirection.RTL` is provided.

### RTL Example
<ExampleCodeBlock code={RTL} />

## Partial and Custom Information Highlights

`Information Highlights` can use custom icons or be designed to only use some of its components.

### Custom Icon: Attention, High Emphasis
<ExampleCodeBlock code={IconAttentionHigh} />
Expand All @@ -89,9 +97,6 @@ It draws the user's attention and can emphasize importance.
### Heading Only Example
<ExampleCodeBlock code={Heading} />

### RTL Example
<ExampleCodeBlock code={RTL} />




Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';

import {InformationHighlight} from '@workday/canvas-kit-preview-react/InformationHighlight';
import {ExternalHyperlink} from '@workday/canvas-kit-react/button';

export const Basic = () => {
return (
Expand All @@ -13,12 +12,7 @@ export const Basic = () => {
This is what an information highlight would look like with with the default settings and
every field filled in{' '}
</InformationHighlight.Body>
<InformationHighlight.Link
as={ExternalHyperlink}
href="https://workday.github.io/canvas-kit/?path=/docs/preview-information-highlight--docs"
>
View the Docs
</InformationHighlight.Link>
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
</InformationHighlight>
);
};
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React from 'react';

import {InformationHighlight} from '@workday/canvas-kit-preview-react/InformationHighlight';
import {ExternalHyperlink} from '@workday/canvas-kit-react/button';
import {chartIcon} from '@workday/canvas-system-icons-web';
import {CanvasProvider, ContentDirection} from '@workday/canvas-kit-react/common';
export const RTL = () => {
const theme = {
Expand All @@ -13,17 +11,10 @@ export const RTL = () => {
return (
<CanvasProvider theme={theme}>
<InformationHighlight variant={'attention'} emphasis={'high'}>
<InformationHighlight.Icon icon={chartIcon} />
<InformationHighlight.Heading> Information Highlight </InformationHighlight.Heading>
<InformationHighlight.Body>
A custom Icon can be added to the Information Highlight component
</InformationHighlight.Body>
<InformationHighlight.Link
as={ExternalHyperlink}
href="https://workday.github.io/canvas-kit/?path=/docs/preview-information-highlight--docs"
>
View the Docs
</InformationHighlight.Link>
<InformationHighlight.Icon icon={undefined} />
<InformationHighlight.Heading> انتباه! من اليمين إلى اليسار </InformationHighlight.Heading>
<InformationHighlight.Body>نحن ندعم اللغات من اليمين إلى اليسار</InformationHighlight.Body>
<InformationHighlight.Link href="#hyperlink">وثائق</InformationHighlight.Link>
</InformationHighlight>
</CanvasProvider>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,27 @@
import React from 'react';

import {InformationHighlight} from '@workday/canvas-kit-preview-react/InformationHighlight';
import {ExternalHyperlink} from '@workday/canvas-kit-react/button';
export const Attention = () => {
return (
<InformationHighlight variant={'attention'}>
<InformationHighlight.Icon icon={undefined} />
<InformationHighlight.Heading> Information Highlight </InformationHighlight.Heading>
<InformationHighlight.Heading> Attention! Highlight Something </InformationHighlight.Heading>
<InformationHighlight.Body>
If you select the link below it will just reroute you back to this page
</InformationHighlight.Body>
<InformationHighlight.Link
as={ExternalHyperlink}
href="https://workday.github.io/canvas-kit/?path=/docs/preview-information-highlight--docs"
>
View the Docs
</InformationHighlight.Link>
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
</InformationHighlight>
);
};
export const AttentionHigh = () => {
return (
<InformationHighlight variant={'attention'} emphasis={'high'}>
<InformationHighlight.Icon icon={undefined} />
<InformationHighlight.Heading> Information Highlight </InformationHighlight.Heading>
<InformationHighlight.Heading> Attention! Highlight Something </InformationHighlight.Heading>
<InformationHighlight.Body>
If you select the link below it will just reroute you back to this page
</InformationHighlight.Body>
<InformationHighlight.Link
as={ExternalHyperlink}
href="https://workday.github.io/canvas-kit/?path=/docs/preview-information-highlight--docs"
>
View the Docs
</InformationHighlight.Link>
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
</InformationHighlight>
);
};
Original file line number Diff line number Diff line change
@@ -1,38 +1,27 @@
import React from 'react';

import {InformationHighlight} from '@workday/canvas-kit-preview-react/InformationHighlight';
import {ExternalHyperlink} from '@workday/canvas-kit-react/button';
export const Caution = () => {
return (
<InformationHighlight variant={'caution'}>
<InformationHighlight.Icon icon={undefined} />
<InformationHighlight.Heading> Information Highlight </InformationHighlight.Heading>
<InformationHighlight.Heading> Caution: Highlight Something </InformationHighlight.Heading>
<InformationHighlight.Body>
If you select the link below it will just reroute you back to this page
</InformationHighlight.Body>
<InformationHighlight.Link
as={ExternalHyperlink}
href="https://workday.github.io/canvas-kit/?path=/docs/preview-information-highlight--docs"
>
View the Docs
</InformationHighlight.Link>
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
</InformationHighlight>
);
};
export const CautionHigh = () => {
return (
<InformationHighlight variant={'caution'} emphasis={'high'}>
<InformationHighlight.Icon icon={undefined} />
<InformationHighlight.Heading> Information Highlight </InformationHighlight.Heading>
<InformationHighlight.Heading> Caution: Highlight Something </InformationHighlight.Heading>
<InformationHighlight.Body>
If you select the link below it will just reroute you back to this page
</InformationHighlight.Body>
<InformationHighlight.Link
as={ExternalHyperlink}
href="https://workday.github.io/canvas-kit/?path=/docs/preview-information-highlight--docs"
>
View the Docs
</InformationHighlight.Link>
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
</InformationHighlight>
);
};
Original file line number Diff line number Diff line change
@@ -1,39 +1,28 @@
import React from 'react';

import {InformationHighlight} from '@workday/canvas-kit-preview-react/InformationHighlight';
import {ExternalHyperlink} from '@workday/canvas-kit-react/button';
import {chartIcon} from '@workday/canvas-system-icons-web';
export const IconAttentionLow = () => {
return (
<InformationHighlight variant={'attention'} emphasis={'low'}>
<InformationHighlight.Icon icon={chartIcon} />
<InformationHighlight.Heading> Information Highlight </InformationHighlight.Heading>
<InformationHighlight.Heading> Attention! Custom Highlight </InformationHighlight.Heading>
<InformationHighlight.Body>
A custom Icon can be added to the Information Highlight component
</InformationHighlight.Body>
<InformationHighlight.Link
as={ExternalHyperlink}
href="https://workday.github.io/canvas-kit/?path=/docs/preview-information-highlight--docs"
>
View the Docs
</InformationHighlight.Link>
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
</InformationHighlight>
);
};
export const IconAttentionHigh = () => {
return (
<InformationHighlight variant={'attention'} emphasis={'high'}>
<InformationHighlight.Icon icon={chartIcon} />
<InformationHighlight.Heading> Information Highlight </InformationHighlight.Heading>
<InformationHighlight.Heading> Attention! Custom Highlight </InformationHighlight.Heading>
<InformationHighlight.Body>
A custom Icon can be added to the Information Highlight component
</InformationHighlight.Body>
<InformationHighlight.Link
as={ExternalHyperlink}
href="https://workday.github.io/canvas-kit/?path=/docs/preview-information-highlight--docs"
>
View the Docs
</InformationHighlight.Link>
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
</InformationHighlight>
);
};
Original file line number Diff line number Diff line change
@@ -1,38 +1,27 @@
import React from 'react';

import {InformationHighlight} from '@workday/canvas-kit-preview-react/InformationHighlight';
import {ExternalHyperlink} from '@workday/canvas-kit-react/button';
export const Informational = () => {
return (
<InformationHighlight variant={'informational'}>
<InformationHighlight.Icon icon={undefined} />
<InformationHighlight.Heading> Information Highlight </InformationHighlight.Heading>
<InformationHighlight.Heading> Informational Highlight </InformationHighlight.Heading>
<InformationHighlight.Body>
If you select the link below it will just reroute you back to this page
</InformationHighlight.Body>
<InformationHighlight.Link
as={ExternalHyperlink}
href="https://workday.github.io/canvas-kit/?path=/docs/preview-information-highlight--docs"
>
View the Docs
</InformationHighlight.Link>
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
</InformationHighlight>
);
};
export const InformationalHigh = () => {
return (
<InformationHighlight variant={'informational'} emphasis={'high'}>
<InformationHighlight.Icon icon={undefined} />
<InformationHighlight.Heading> Information Highlight </InformationHighlight.Heading>
<InformationHighlight.Heading> Informational Highlight </InformationHighlight.Heading>
<InformationHighlight.Body>
If you select the link below it will just reroute you back to this page
</InformationHighlight.Body>
<InformationHighlight.Link
as={ExternalHyperlink}
href="https://workday.github.io/canvas-kit/?path=/docs/preview-information-highlight--docs"
>
View the Docs
</InformationHighlight.Link>
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
</InformationHighlight>
);
};

0 comments on commit 44f8c57

Please sign in to comment.