Skip to content

Commit

Permalink
feat: theme add links textDecoration options (#1599)
Browse files Browse the repository at this point in the history
Co-authored-by: Anastasiia Derymarko <anastasiia@redocly.com>
Co-authored-by: Loïc Fürhoff <loic.furhoff@pix4d.com>
  • Loading branch information
3 people authored May 16, 2022
1 parent 660cc85 commit ba06485
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ You can use all of the following options with the standalone version of the <red
* `color`: # COMPUTED: colors.primary.main
* `visited`: # COMPUTED: typography.links.color
* `hover`: # COMPUTED: lighten(0.2 typography.links.color)
* `textDecoration`: 'auto'
* `hoverTextDecoration`: 'auto'
* `sidebar`
* `width`: '260px'
* `backgroundColor`: '#fafafa'
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"start:benchmark": "webpack serve --mode=production --env.bench --config demo/webpack.config.ts",
"test": "npm run unit && npm run license-check",
"unit": "jest --coverage",
"test:update-snapshot": "jest --updateSnapshot",
"e2e": "cypress run",
"e2e-ci": "cypress run --record",
"bundlesize": "size-limit",
Expand Down
3 changes: 2 additions & 1 deletion src/components/Markdown/styled.elements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { StyledComponent } from 'styled-components';

export const linksCss = css`
a {
text-decoration: none;
text-decoration: ${props => props.theme.typography.links.textDecoration};
color: ${props => props.theme.typography.links.color};
&:visited {
Expand All @@ -15,6 +15,7 @@ export const linksCss = css`
&:hover {
color: ${props => props.theme.typography.links.hover};
text-decoration: ${props => props.theme.typography.links.hoverTextDecoration};
}
}
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
"links": Object {
"color": "#32329f",
"hover": "#6868cf",
"hoverTextDecoration": "auto",
"textDecoration": "auto",
"visited": "#32329f",
},
"optimizeSpeed": true,
Expand Down Expand Up @@ -527,6 +529,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
"links": Object {
"color": "#32329f",
"hover": "#6868cf",
"hoverTextDecoration": "auto",
"textDecoration": "auto",
"visited": "#32329f",
},
"optimizeSpeed": true,
Expand Down Expand Up @@ -757,6 +761,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
"links": Object {
"color": "#32329f",
"hover": "#6868cf",
"hoverTextDecoration": "auto",
"textDecoration": "auto",
"visited": "#32329f",
},
"optimizeSpeed": true,
Expand Down Expand Up @@ -1054,6 +1060,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
"links": Object {
"color": "#32329f",
"hover": "#6868cf",
"hoverTextDecoration": "auto",
"textDecoration": "auto",
"visited": "#32329f",
},
"optimizeSpeed": true,
Expand Down Expand Up @@ -1309,6 +1317,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
"links": Object {
"color": "#32329f",
"hover": "#6868cf",
"hoverTextDecoration": "auto",
"textDecoration": "auto",
"visited": "#32329f",
},
"optimizeSpeed": true,
Expand Down Expand Up @@ -1539,6 +1549,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
"links": Object {
"color": "#32329f",
"hover": "#6868cf",
"hoverTextDecoration": "auto",
"textDecoration": "auto",
"visited": "#32329f",
},
"optimizeSpeed": true,
Expand Down Expand Up @@ -1792,6 +1804,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
"links": Object {
"color": "#32329f",
"hover": "#6868cf",
"hoverTextDecoration": "auto",
"textDecoration": "auto",
"visited": "#32329f",
},
"optimizeSpeed": true,
Expand Down Expand Up @@ -2086,6 +2100,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
"links": Object {
"color": "#32329f",
"hover": "#6868cf",
"hoverTextDecoration": "auto",
"textDecoration": "auto",
"visited": "#32329f",
},
"optimizeSpeed": true,
Expand Down Expand Up @@ -2341,6 +2357,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
"links": Object {
"color": "#32329f",
"hover": "#6868cf",
"hoverTextDecoration": "auto",
"textDecoration": "auto",
"visited": "#32329f",
},
"optimizeSpeed": true,
Expand Down Expand Up @@ -2571,6 +2589,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
"links": Object {
"color": "#32329f",
"hover": "#6868cf",
"hoverTextDecoration": "auto",
"textDecoration": "auto",
"visited": "#32329f",
},
"optimizeSpeed": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ exports[`Components SchemaView OneOf deprecated should match snapshot 1`] = `
<div>
<div
class="sc-iJCRrE sc-ciSkZP jCdxGr emlfPd"
class="sc-iJCRrE sc-ciSkZP jCdxGr lhENGb"
/>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ const defaultTheme: ThemeInterface = {
color: ({ colors }) => colors.primary.main,
visited: ({ typography }) => typography.links.color,
hover: ({ typography }) => lighten(0.2, typography.links.color),
textDecoration: 'auto',
hoverTextDecoration: 'auto',
},
},
sidebar: {
Expand Down Expand Up @@ -315,6 +317,8 @@ export interface ResolvedThemeInterface {
color: string;
visited: string;
hover: string;
textDecoration: string;
hoverTextDecoration: string;
};
};
sidebar: {
Expand Down

0 comments on commit ba06485

Please sign in to comment.