Skip to content

Commit

Permalink
feat: refactoring and added content to the kitchen sink page
Browse files Browse the repository at this point in the history
  • Loading branch information
bzavhorodskyi committed Jan 18, 2024
1 parent a94e80f commit 71a4f1c
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 30 deletions.
2 changes: 1 addition & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default defineConfig({
"@components/Abbr.astro",
"@components/Badge.astro",
"@components/Tooltip.astro",
"@components/VersionSwitch/Version.astro",
"@components/Version.astro",
"@components/FigmaEmbed/FigmaEmbed.astro",
],
}),
Expand Down
8 changes: 4 additions & 4 deletions src/components/Layout/PageContent/PageContent.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import classNames from "classnames";
import RightSidebar from "../RightSidebar/RightSidebar.astro";
import type { NavigationData } from "@utils/helpers/navigation/types";
import CategoryCard from "@components/Cards/CategoryCard.astro";
import VersionSwitch from "@components/VersionSwitch/VersionSwitch";
import VersionSwitch from "@components/Version/VersionSwitch";
import "./article.css";
Expand All @@ -26,11 +26,11 @@ const { title, headings, childLinks } = Astro.props;
<aside title="Table of Contents">
<RightSidebar headings={headings} title={title} />
</aside>
<VersionSwitch client:only="react" />
<div
class={classNames({ "article-content": !childLinks.length })}
id="article-content"
class={classNames({ "article-content": !childLinks.length })}
id="article-content"
>
<VersionSwitch client:only="react" />
<slot />
<!-- Category cards for the entry with "category" type and childs -->
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
import VersionComponent from "./VersionComponent";
import VersionComponent from "./Version/VersionComponent";
const {version} = Astro.props;
let content = "";
Expand Down
File renamed without changes.
27 changes: 27 additions & 0 deletions src/components/Version/VersionSwitch.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { FC } from "react";
import { ComboBox } from "@adjust/components";
import { useStore } from "@nanostores/react";

import { $versions, changeVersionValue } from "@store/versionsStore";

const VersionSwitch: FC = () => {
const versions = useStore($versions);

if (versions.items.length < 1) {
// we don`t need to display the version switch when we have only one or less options
return null;
}

return (
<div className="flex flex-col w-full min-h-90px justify-start gap-y-8 bg-slate-100 p-6 rounded-lg mb-14 md:flex-row md:items-center md:gap-x-8">
<label>Select your SDK version:</label>
<ComboBox
value={versions.currentVersion}
options={versions.items}
onChange={changeVersionValue}
/>
</div>
);
};

export default VersionSwitch;
18 changes: 0 additions & 18 deletions src/components/VersionSwitch/VersionSwitch.tsx

This file was deleted.

10 changes: 4 additions & 6 deletions src/content/docs/en/kitchen-sink/version-switch.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ description: "Reference for the version switch component"
slug: en/kitchen-sink/version-switch
---

Use tabs to group information together and enable readers to switch between the content the want to see.
Use the Version component to group information depending on the version of the SDK.

## Props

Use props to control the behavior of tabs

<Table>

| Prop | Data type | Required | Description |
| ------- | --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `title` | String | Yes | The title of the tab |
| `icon` | IconName | No | An optional icon that appears on the left of the panel. See [the list of icons in ATLAS](https://atlas.adeven.com/docs/components/Icon#available-icons) |
| `sync` | String | No | The sync ID of the tab. Add the same `sync` ID to all tabs you want to synchronize. |
| Prop | Data type | Required | Description |
| --------- | --------- | -------- | ----------------------------------------------------------------------- |
| `version` | String | Yes | A version of the SDK in which we should display content from this block |

Check warning on line 17 in src/content/docs/en/kitchen-sink/version-switch.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/en/kitchen-sink/version-switch.mdx#L17

[Microsoft.We] Try to avoid using first-person plural like 'we'.
Raw output
{"message": "[Microsoft.We] Try to avoid using first-person plural like 'we'.", "location": {"path": "src/content/docs/en/kitchen-sink/version-switch.mdx", "range": {"start": {"line": 17, "column": 68}}}, "severity": "WARNING"}

</Table>

Expand Down

0 comments on commit 71a4f1c

Please sign in to comment.