Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Refactor styles

Mateusz Stanielewicz3a3c01bd194e
diff --git a/saleor/static/dashboard-next/components/ExternalLink/ExternalLink.tsx b/saleor/static/dashboard-next/components/ExternalLink/ExternalLink.tsx
index e69d4f194c..f30d352d6d 100644
--- a/saleor/static/dashboard-next/components/ExternalLink/ExternalLink.tsx
+++ b/saleor/static/dashboard-next/components/ExternalLink/ExternalLink.tsx
@@ -1,7 +1,5 @@
import { withStyles } from "@material-ui/core/styles";
import Typography, { TypographyProps } from "@material-ui/core/Typography";
-import blue from "@material-ui/core/colors/blue";
-import * as classNames from "classnames";
import * as React from "react";
interface ExternalLinkProps extends React.HTMLProps<HTMLAnchorElement> {
@@ -12,20 +10,18 @@ interface ExternalLinkProps extends React.HTMLProps<HTMLAnchorElement> {
const decorate = withStyles({
link: {
- color: blue[500],
- cursor: "pointer",
textDecoration: "none",
},
});
const ExternalLink = decorate<ExternalLinkProps>(
- ({ classes, className, children, href, theme, typographyProps, ...props }) => (
+ ({ classes, className, children, href, typographyProps, ...props }) => (
<>
<a
href={href}
- className={classNames(classes.link, className)}
+ className={classes.link}
{...props}
>
- <Typography {...typographyProps}>{children}</Typography>
+ <Typography className={className} color="secondary" {...typographyProps}>{children}</Typography>
</a>
</>
)
diff --git a/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap b/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap
index c9e95f6da1..f5ed2e3d70 100644
--- a/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap
+++ b/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap
@@ -1298,6 +1298,37 @@ exports[`Storyshots Generics / ErrorMessageCard default 1`] = `
</div>
`;
+exports[`Storyshots Generics / External Link default 1`] = `
+<div>
+ <a
+ class="Component-link-id"
+ href="http://www.google.com"
+ >
+ <p
+ class="MuiTypography-root-id MuiTypography-body1-id MuiTypography-colorSecondary-id"
+ >
+ Link to google.com
+ </p>
+ </a>
+</div>
+`;
+
+exports[`Storyshots Generics / External Link new tab 1`] = `
+<div>
+ <a
+ class="Component-link-id"
+ href="http://www.google.com"
+ target="_blank"
+ >
+ <p
+ class="MuiTypography-root-id MuiTypography-body1-id MuiTypography-colorSecondary-id"
+ >
+ Link to google.com
+ </p>
+ </a>
+</div>
+`;
+
exports[`Storyshots Generics / Global messages default 1`] = `
<div>
<button
@@ -4637,7 +4668,7 @@ exports[`Storyshots Orders / OrderCustomer when loaded data 1`] = `
href="mailto:[email protected]"
>
<p
- class="MuiTypography-root-id MuiTypography-body1-id"
+ class="MuiTypography-root-id MuiTypography-body1-id MuiTypography-colorSecondary-id"
>
</p>
@@ -4854,7 +4885,7 @@ exports[`Storyshots Orders / OrderCustomer with different addresses 1`] = `
href="mailto:[email protected]"
>
<p
- class="MuiTypography-root-id MuiTypography-body1-id"
+ class="MuiTypography-root-id MuiTypography-body1-id MuiTypography-colorSecondary-id"
>
</p>
diff --git a/saleor/static/dashboard-next/storybook/config.js b/saleor/static/dashboard-next/storybook/config.js
index 9e1e035966..d69a5f243c 100644
--- a/saleor/static/dashboard-next/storybook/config.js
+++ b/saleor/static/dashboard-next/storybook/config.js
@@ -9,6 +9,7 @@ function loadStories() {
require("./stories/components/DateFormatter");
require("./stories/components/EditableTableCell");
require("./stories/components/ErrorMessageCard");
+ require("./stories/components/ExternalLink");
require("./stories/components/Money");
require("./stories/components/MultiAutocompleteSelectField");
require("./stories/components/MultiSelectField");
diff --git a/saleor/static/dashboard-next/storybook/stories/components/ExternalLink.tsx b/saleor/static/dashboard-next/storybook/stories/components/ExternalLink.tsx
index cf3297c515..19d77ed440 100644
--- a/saleor/static/dashboard-next/storybook/stories/components/ExternalLink.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/components/ExternalLink.tsx
@@ -4,6 +4,7 @@ import * as React from "react";
import ExternalLink from "../../../components/ExternalLink";
import Decorator from "../../Decorator";
-storiesOf("Generics / ExternalLink", module)
+storiesOf("Generics / External Link", module)
.addDecorator(Decorator)
- .add("default", () => <ExternalLink href="http://www.google.pl" />);
+ .add("default", () => <ExternalLink href="http://www.google.com">Link to google.com</ExternalLink>)
+ .add("new tab", () => <ExternalLink href="http://www.google.com" target="_blank">Link to google.com</ExternalLink>);