Skip to content

Commit

Permalink
feat: add support of react 18 (#2369)
Browse files Browse the repository at this point in the history
* feat: add support of react 18

* chore: add newest version of styled-components to peerDependencies

* chore: add supoort of styled components

* chore: downgrade types

* chore: update snapshots
  • Loading branch information
RomanPidkostelnyi authored Jul 26, 2023
1 parent 0bb21c8 commit 054f604
Show file tree
Hide file tree
Showing 8 changed files with 2,022 additions and 1,523 deletions.
3,480 changes: 1,985 additions & 1,495 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@
"peerDependencies": {
"core-js": "^3.1.4",
"mobx": "^6.0.4",
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0",
"styled-components": "^4.1.1 || ^5.1.1"
"react": "^16.8.4 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.4 || ^17.0.0 || ^18.0.0",
"styled-components": "^4.1.1 || ^5.1.1 || ^6.0.5"
},
"dependencies": {
"@redocly/openapi-core": "^1.0.0-beta.104",
Expand Down
4 changes: 3 additions & 1 deletion src/common-elements/fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ export const TypeTitle = styled(FieldLabel)`

export const TypeFormat = TypeName;

export const RequiredLabel = styled(FieldLabel.withComponent('div'))`
export const RequiredLabel = styled(FieldLabel).attrs({
as: 'div',
})`
color: ${props => props.theme.schema.requireLabelColor};
font-size: ${props => props.theme.schema.labelsTextSize};
font-weight: normal;
Expand Down
4 changes: 3 additions & 1 deletion src/common-elements/samples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export const SampleControlsWrap = styled.div`
}
`;

export const StyledPre = styled(PrismDiv.withComponent('pre'))`
export const StyledPre = styled(PrismDiv).attrs({
as: 'pre',
})`
font-family: ${props => props.theme.typography.code.fontFamily};
font-size: ${props => props.theme.typography.code.fontSize};
overflow-x: auto;
Expand Down
5 changes: 4 additions & 1 deletion src/components/Markdown/SanitizedMdBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ import * as React from 'react';
import { OptionsConsumer } from '../OptionsProvider';
import { StylingMarkdownProps } from './Markdown';
import { StyledMarkdownBlock } from './styled.elements';
import styled from 'styled-components';

const StyledMarkdownSpan = StyledMarkdownBlock.withComponent('span');
const StyledMarkdownSpan = styled(StyledMarkdownBlock)`
display: inline;
`;

const sanitize = (untrustedSpec, html) => (untrustedSpec ? DOMPurify.sanitize(html) : html);

Expand Down
4 changes: 3 additions & 1 deletion src/components/Responses/styled.elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export const ResponseDetailsWrap = styled.div`
padding: 10px;
`;

export const HeadersCaption = styled(UnderlinedHeader.withComponent('caption'))`
export const HeadersCaption = styled(UnderlinedHeader).attrs({
as: 'caption',
})`
text-align: left;
margin-top: 1em;
caption-side: top;
Expand Down
16 changes: 8 additions & 8 deletions src/components/__tests__/__snapshots__/OneOfSchema.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@
exports[`Components SchemaView OneOf deprecated should match snapshot 1`] = `
<div>
<span
class="sc-kfYoZR juYXUf"
class="sc-fUnMCh hPwMmL"
>
One of
</span>
<div
class="sc-dlMDgC EoFth"
class="sc-feUZmu bTropM"
>
<button
class="sc-fKgJPI iEPbLk"
class="sc-hzhJZQ ilKqWS"
>
string
</button>
<button
class="sc-fKgJPI bpjiHN"
class="sc-hzhJZQ emRRrf"
>
integer
</button>
</div>
<div>
<span
class="sc-bqGGPW eSYQnm"
class="sc-jEACwC gWyYnj"
type="warning"
>
Deprecated
Expand All @@ -33,18 +33,18 @@ exports[`Components SchemaView OneOf deprecated should match snapshot 1`] = `
<div>
<div>
<span
class="sc-laZMeE sc-iNiQyp jWaWWE jrLlAa"
class="sc-Nxspf sc-cfxfcM cXxAXt jrGEaR"
/>
<span
class="sc-laZMeE sc-jffHpj jWaWWE cThoNa"
class="sc-Nxspf sc-gFAWRd cXxAXt dYzdDr"
>
string
</span>
</div>
<div>
<div
class="sc-iJCRrE sc-ciSkZP jCdxGr lhENGb"
class="sc-eeDRCY sc-eBMEME gTGgei hXXgcw"
/>
</div>
</div>
Expand Down

Large diffs are not rendered by default.

0 comments on commit 054f604

Please sign in to comment.