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>
This commit is contained in:
Loïc Fürhoff 2022-05-16 10:49:22 +02:00 committed by GitHub
parent 660cc857bc
commit ba06485ece
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 2 deletions

View File

@ -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'

View File

@ -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",

View File

@ -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 {
@ -15,6 +15,7 @@ export const linksCss = css`
&:hover {
color: ${props => props.theme.typography.links.hover};
text-decoration: ${props => props.theme.typography.links.hoverTextDecoration};
}
}
`;

View File

@ -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,
@ -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,
@ -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,
@ -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,
@ -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,
@ -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,
@ -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,
@ -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,
@ -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,
@ -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,

View File

@ -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>

View File

@ -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: {
@ -315,6 +317,8 @@ export interface ResolvedThemeInterface {
color: string;
visited: string;
hover: string;
textDecoration: string;
hoverTextDecoration: string;
};
};
sidebar: {