Skip to content

Commit

Permalink
fix multiline deprecation display issue #3348
Browse files Browse the repository at this point in the history
  • Loading branch information
acao committed Jul 16, 2023
1 parent ffb6486 commit 17069e7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .changeset/fifty-numbers-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'graphiql': patch
'@graphiql/react': patch
---

fix display of deprecation reason on field type docs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ type DeprecationReasonProps = {
* The deprecation reason as markdown string.
*/
children?: string | null;
preview?: boolean;
};

export function DeprecationReason(props: DeprecationReasonProps) {
return props.children ? (
<div className="graphiql-doc-explorer-deprecation">
<div className="graphiql-doc-explorer-deprecation-label">Deprecated</div>
<MarkdownContent type="deprecation" onlyShowFirstChild>
<MarkdownContent
type="deprecation"
onlyShowFirstChild={props.preview ?? true}
>
{props.children}
</MarkdownContent>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export function FieldDocumentation(props: FieldDocumentationProps) {
{props.field.description}
</MarkdownContent>
) : null}
<DeprecationReason>{props.field.deprecationReason}</DeprecationReason>
<DeprecationReason preview={false}>
{props.field.deprecationReason}
</DeprecationReason>
<ExplorerSection title="Type">
<TypeLink type={props.field.type} />
</ExplorerSection>
Expand Down
12 changes: 6 additions & 6 deletions packages/graphiql/resources/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const relPath = (...args) => path.resolve(__dirname, ...args);
const rootPath = (...args) => relPath('../', ...args);

const resultConfig = ({ isDev = false }) => {
const isHMR = Boolean(isDev && process.env.WEBPACK_DEV_SERVER);
const isHMR = Boolean(isDev && process.env.WEBPACK_SERVE);

const config = {
mode: isDev ? 'development' : 'production',
Expand Down Expand Up @@ -126,8 +126,8 @@ const resultConfig = ({ isDev = false }) => {
}
return config;
};

module.exports = [
resultConfig({ isDev: true }),
resultConfig({ isDev: false }),
];
const configs = [resultConfig({ isDev: true })];
if (!process.env.WEBPACK_SERVE) {
configs.push(resultConfig({ isDev: false }));
}
module.exports = configs;

0 comments on commit 17069e7

Please sign in to comment.