Skip to content

Commit

Permalink
Docs Fixes (airbytehq#33656)
Browse files Browse the repository at this point in the history
  • Loading branch information
evantahler authored and jatinyadav-cc committed Feb 26, 2024
1 parent 76a64b1 commit 57f62b1
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 42 deletions.
99 changes: 63 additions & 36 deletions docusaurus/src/components/HeaderDecoration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,75 @@ const capitalizeFirstLetter = (string) => {
return string.charAt(0).toUpperCase() + string.slice(1);
};

const CHECK_ICON = <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"><title>Available</title><path fill="currentColor" d="M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-111 111-47-47c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l64 64c9.4 9.4 24.6 9.4 33.9 0L369 209z" /></svg>;
const CROSS_ICON = <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"><title>Not available</title><path fill="currentColor" d="M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c-9.4 9.4-9.4 24.6 0 33.9l47 47-47 47c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l47-47 47 47c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-47-47 47-47c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-47 47-47-47c-9.4-9.4-24.6-9.4-33.9 0z" /></svg>;
const CHECK_ICON = (
<svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512">
<title>Available</title>
<path
fill="currentColor"
d="M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-111 111-47-47c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l64 64c9.4 9.4 24.6 9.4 33.9 0L369 209z"
/>
</svg>
);
const CROSS_ICON = (
<svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512">
<title>Not available</title>
<path
fill="currentColor"
d="M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c-9.4 9.4-9.4 24.6 0 33.9l47 47-47 47c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l47-47 47 47c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-47-47 47-47c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-47 47-47-47c-9.4-9.4-24.6-9.4-33.9 0z"
/>
</svg>
);

export const HeaderDecoration = ({
isOss,
isCloud,
isOss: isOssString,
isCloud: isCloudString,
dockerImageTag,
supportLevel,
iconUrl,
originalTitle,
originalId
originalId,
github_url,
}) => {
return <>
<dl className={styles.connectorMetadata}>
<div>
<dt>Availability</dt>
<dd className={styles.availability}>
<span className={
isCloud ? styles.available : styles.unavailable
}>{
isCloud ? CHECK_ICON : CROSS_ICON
} Airbyte Cloud</span>
<span className={isOss ? styles.available : styles.unavailable}>{
isOss ? CHECK_ICON : CROSS_ICON
} Airbyte OSS</span>
</dd>
</div>
<div>
<dt>Support Level</dt>
<dd>
<a href="/project-overview/product-support-levels/">{capitalizeFirstLetter(supportLevel)}</a>
</dd>
</div>
<div>
<dt>Latest Version</dt>
<dd>{dockerImageTag}</dd>
const isOss = isOssString.toUpperCase() === "TRUE";
const isCloud = isCloudString.toUpperCase() === "TRUE";

return (
<>
<dl className={styles.connectorMetadata}>
<div>
<dt>Availability</dt>
<dd className={styles.availability}>
<span className={isCloud ? styles.available : styles.unavailable}>
{isCloud ? CHECK_ICON : CROSS_ICON} Airbyte Cloud
</span>
<span className={isOss ? styles.available : styles.unavailable}>
{isOss ? CHECK_ICON : CROSS_ICON} Airbyte OSS
</span>
</dd>
</div>
<div>
<dt>Support Level</dt>
<dd>
<a href="/project-overview/product-support-levels/">
{capitalizeFirstLetter(supportLevel)}
</a>
</dd>
</div>
<div>
<dt>Latest Version</dt>
<dd>
<a href={github_url} target="_blank">
{dockerImageTag}
</a>
</dd>
</div>
</dl>

<div className={styles.header}>
<img src={iconUrl} alt="" className={styles.connectorIcon} />
<h1 id={originalId}>{originalTitle}</h1>
</div>
</dl>
</>
);
};

<div className={styles.header}>
<img src={iconUrl} alt="" className={styles.connectorIcon} />
<h1 id={originalId}>{originalTitle}</h1>
</div>
</>;
};
15 changes: 9 additions & 6 deletions docusaurus/src/remark/docsHeaderDecoration.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ const fetchCatalog = async () => {

const catalog = fetchCatalog();

const toAttributes = (props) => Object.entries(props).map(([key, value]) => ({
type: "mdxJsxAttribute",
name: key,
value: value
const toAttributes = (props) =>
Object.entries(props).map(([key, value]) => ({
type: "mdxJsxAttribute",
name: key,
value: value,
}));

const plugin = () => {
Expand Down Expand Up @@ -50,14 +51,16 @@ const plugin = () => {
node.children = [];
node.type = "mdxJsxFlowElement";
node.name = "HeaderDecoration";
node.attributes = toAttributes({
node.attributes = toAttributes({
isOss: registryEntry.is_oss,
isCloud: registryEntry.is_cloud,
supportLevel: registryEntry.supportLevel_oss,
dockerImageTag: registryEntry.dockerImageTag_oss,
iconUrl: registryEntry.iconUrl_oss,
github_url: registryEntry.github_url,
issue_url: registryEntry.issue_url,
originalTitle,
originalId
originalId,
});
}
});
Expand Down

0 comments on commit 57f62b1

Please sign in to comment.