Skip to content

Commit ba06485

Browse files
Loïc Fürhoffanastasiia-developerLoïc Fürhoff
authored
feat: theme add links textDecoration options (#1599)
Co-authored-by: Anastasiia Derymarko <anastasiia@redocly.com> Co-authored-by: Loïc Fürhoff <loic.furhoff@pix4d.com>
1 parent 660cc85 commit ba06485

File tree

6 files changed

+30
-2
lines changed

6 files changed

+30
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ You can use all of the following options with the standalone version of the <red
289289
* `color`: # COMPUTED: colors.primary.main
290290
* `visited`: # COMPUTED: typography.links.color
291291
* `hover`: # COMPUTED: lighten(0.2 typography.links.color)
292+
* `textDecoration`: 'auto'
293+
* `hoverTextDecoration`: 'auto'
292294
* `sidebar`
293295
* `width`: '260px'
294296
* `backgroundColor`: '#fafafa'

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"start:benchmark": "webpack serve --mode=production --env.bench --config demo/webpack.config.ts",
3535
"test": "npm run unit && npm run license-check",
3636
"unit": "jest --coverage",
37+
"test:update-snapshot": "jest --updateSnapshot",
3738
"e2e": "cypress run",
3839
"e2e-ci": "cypress run --record",
3940
"bundlesize": "size-limit",

src/components/Markdown/styled.elements.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { StyledComponent } from 'styled-components';
66

77
export const linksCss = css`
88
a {
9-
text-decoration: none;
9+
text-decoration: ${props => props.theme.typography.links.textDecoration};
1010
color: ${props => props.theme.typography.links.color};
1111
1212
&:visited {
@@ -15,6 +15,7 @@ export const linksCss = css`
1515
1616
&:hover {
1717
color: ${props => props.theme.typography.links.hover};
18+
text-decoration: ${props => props.theme.typography.links.hoverTextDecoration};
1819
}
1920
}
2021
`;

src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
272272
"links": Object {
273273
"color": "#32329f",
274274
"hover": "#6868cf",
275+
"hoverTextDecoration": "auto",
276+
"textDecoration": "auto",
275277
"visited": "#32329f",
276278
},
277279
"optimizeSpeed": true,
@@ -527,6 +529,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
527529
"links": Object {
528530
"color": "#32329f",
529531
"hover": "#6868cf",
532+
"hoverTextDecoration": "auto",
533+
"textDecoration": "auto",
530534
"visited": "#32329f",
531535
},
532536
"optimizeSpeed": true,
@@ -757,6 +761,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
757761
"links": Object {
758762
"color": "#32329f",
759763
"hover": "#6868cf",
764+
"hoverTextDecoration": "auto",
765+
"textDecoration": "auto",
760766
"visited": "#32329f",
761767
},
762768
"optimizeSpeed": true,
@@ -1054,6 +1060,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
10541060
"links": Object {
10551061
"color": "#32329f",
10561062
"hover": "#6868cf",
1063+
"hoverTextDecoration": "auto",
1064+
"textDecoration": "auto",
10571065
"visited": "#32329f",
10581066
},
10591067
"optimizeSpeed": true,
@@ -1309,6 +1317,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
13091317
"links": Object {
13101318
"color": "#32329f",
13111319
"hover": "#6868cf",
1320+
"hoverTextDecoration": "auto",
1321+
"textDecoration": "auto",
13121322
"visited": "#32329f",
13131323
},
13141324
"optimizeSpeed": true,
@@ -1539,6 +1549,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
15391549
"links": Object {
15401550
"color": "#32329f",
15411551
"hover": "#6868cf",
1552+
"hoverTextDecoration": "auto",
1553+
"textDecoration": "auto",
15421554
"visited": "#32329f",
15431555
},
15441556
"optimizeSpeed": true,
@@ -1792,6 +1804,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
17921804
"links": Object {
17931805
"color": "#32329f",
17941806
"hover": "#6868cf",
1807+
"hoverTextDecoration": "auto",
1808+
"textDecoration": "auto",
17951809
"visited": "#32329f",
17961810
},
17971811
"optimizeSpeed": true,
@@ -2086,6 +2100,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
20862100
"links": Object {
20872101
"color": "#32329f",
20882102
"hover": "#6868cf",
2103+
"hoverTextDecoration": "auto",
2104+
"textDecoration": "auto",
20892105
"visited": "#32329f",
20902106
},
20912107
"optimizeSpeed": true,
@@ -2341,6 +2357,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
23412357
"links": Object {
23422358
"color": "#32329f",
23432359
"hover": "#6868cf",
2360+
"hoverTextDecoration": "auto",
2361+
"textDecoration": "auto",
23442362
"visited": "#32329f",
23452363
},
23462364
"optimizeSpeed": true,
@@ -2571,6 +2589,8 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
25712589
"links": Object {
25722590
"color": "#32329f",
25732591
"hover": "#6868cf",
2592+
"hoverTextDecoration": "auto",
2593+
"textDecoration": "auto",
25742594
"visited": "#32329f",
25752595
},
25762596
"optimizeSpeed": true,

src/components/__tests__/__snapshots__/OneOfSchema.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ exports[`Components SchemaView OneOf deprecated should match snapshot 1`] = `
4444
4545
<div>
4646
<div
47-
class="sc-iJCRrE sc-ciSkZP jCdxGr emlfPd"
47+
class="sc-iJCRrE sc-ciSkZP jCdxGr lhENGb"
4848
/>
4949
</div>
5050
</div>

src/theme.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ const defaultTheme: ThemeInterface = {
128128
color: ({ colors }) => colors.primary.main,
129129
visited: ({ typography }) => typography.links.color,
130130
hover: ({ typography }) => lighten(0.2, typography.links.color),
131+
textDecoration: 'auto',
132+
hoverTextDecoration: 'auto',
131133
},
132134
},
133135
sidebar: {
@@ -315,6 +317,8 @@ export interface ResolvedThemeInterface {
315317
color: string;
316318
visited: string;
317319
hover: string;
320+
textDecoration: string;
321+
hoverTextDecoration: string;
318322
};
319323
};
320324
sidebar: {

0 commit comments

Comments
 (0)