Skip to content

feat(website): Add a happy message to playground output pane when no errors or AST (#5868) #5873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 43 additions & 25 deletions packages/website/src/components/ErrorsViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ function ErrorBlock({
);
}

function SuccessBlock(): JSX.Element {
return (
<div className="admonition alert alert--success">
<div className="admonition-content">
<div className={styles.fixerContainer}>
<div>All is ok!</div>
</div>
</div>
</div>
);
}

export default function ErrorsViewer({
value,
}: ErrorsViewerProps): JSX.Element {
Expand All @@ -113,31 +125,37 @@ export default function ErrorsViewer({

return (
<div className={styles.list}>
{value?.map(({ group, uri, items }) => {
return (
<div className="margin-top--sm" key={group}>
<h4>
{group}
{uri && (
<>
{' - '}
<a href={uri} target="_blank">
docs <IconExternalLink width={13.5} height={13.5} />
</a>
</>
)}
</h4>
{items.map((item, index) => (
<ErrorBlock
isLocked={isLocked}
setIsLocked={setIsLocked}
item={item}
key={index}
/>
))}
</div>
);
})}
{value?.length ? (
value.map(({ group, uri, items }) => {
return (
<div className="margin-top--md" key={group}>
<h4>
{group}
{uri && (
<>
{' - '}
<a href={uri} target="_blank">
docs <IconExternalLink width={13.5} height={13.5} />
</a>
</>
)}
</h4>
{items.map((item, index) => (
<ErrorBlock
isLocked={isLocked}
setIsLocked={setIsLocked}
item={item}
key={index}
/>
))}
</div>
);
})
) : (
<div className="margin-top--md">
<SuccessBlock />
</div>
)}
</div>
);
}