mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
docs: link source code to folder for multiple components (#1582)
* docs: link source code to folder for multiple components * chore(docs): remove unused `source` from frontmatter
This commit is contained in:
parent
f7969c64e8
commit
27da2a0f8b
10 changed files with 21 additions and 31 deletions
|
@ -22,7 +22,6 @@
|
||||||
|
|
||||||
export let component = $page.title;
|
export let component = $page.title;
|
||||||
export let components = [component];
|
export let components = [component];
|
||||||
export let source = "";
|
|
||||||
export let unreleased = false;
|
export let unreleased = false;
|
||||||
export let unstable = false;
|
export let unstable = false;
|
||||||
|
|
||||||
|
@ -42,10 +41,28 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function formatSourceURL(multiple) {
|
||||||
|
const filePath = api_components[0]?.filePath ?? "";
|
||||||
|
|
||||||
|
if (multiple) {
|
||||||
|
/**
|
||||||
|
* Link to folder for doc with multiple components.
|
||||||
|
* @example "src/Breadcrumb"
|
||||||
|
*/
|
||||||
|
return filePath.split("/").slice(0, -1).join("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Else, link to the component source.
|
||||||
|
* @example "src/Tile/ClickableTile.svelte"
|
||||||
|
*/
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: [refactor] read from package.json value
|
// TODO: [refactor] read from package.json value
|
||||||
$: sourceCode = `https://github.com/carbon-design-system/carbon-components-svelte/tree/master/src/${
|
$: sourceCode = `https://github.com/carbon-design-system/carbon-components-svelte/tree/master/${formatSourceURL(
|
||||||
source || `${$page.title}/${$page.title}.svelte`
|
multiple
|
||||||
}`;
|
)}`;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Content data-components>
|
<Content data-components>
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
---
|
|
||||||
source: Button/ButtonSet.svelte
|
|
||||||
---
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Button, ButtonSet } from "carbon-components-svelte";
|
import { Button, ButtonSet } from "carbon-components-svelte";
|
||||||
import Login from "carbon-icons-svelte/lib/Login.svelte";
|
import Login from "carbon-icons-svelte/lib/Login.svelte";
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
---
|
|
||||||
source: Tile/ClickableTile.svelte
|
|
||||||
---
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ClickableTile } from "carbon-components-svelte";
|
import { ClickableTile } from "carbon-components-svelte";
|
||||||
import Preview from "../../components/Preview.svelte";
|
import Preview from "../../components/Preview.svelte";
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
---
|
|
||||||
source: Tile/ExpandableTile.svelte
|
|
||||||
---
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ExpandableTile, Button } from "carbon-components-svelte";
|
import { ExpandableTile, Button } from "carbon-components-svelte";
|
||||||
import Preview from "../../components/Preview.svelte";
|
import Preview from "../../components/Preview.svelte";
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
---
|
---
|
||||||
components: ["InlineNotification", "NotificationActionButton"]
|
components: ["InlineNotification", "NotificationActionButton"]
|
||||||
source: Notification/InlineNotification.svelte
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
---
|
|
||||||
source: TextInput/PasswordInput.svelte
|
|
||||||
---
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { PasswordInput } from "carbon-components-svelte";
|
import { PasswordInput } from "carbon-components-svelte";
|
||||||
import Preview from "../../components/Preview.svelte";
|
import Preview from "../../components/Preview.svelte";
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
---
|
---
|
||||||
components: ["TileGroup", "RadioTile"]
|
components: ["TileGroup", "RadioTile"]
|
||||||
source: Tile/RadioTile.svelte
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
---
|
---
|
||||||
components: ["SelectableTile"]
|
components: ["SelectableTile"]
|
||||||
source: Tile/SelectableTile.svelte
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
---
|
|
||||||
source: Tile/Tile.svelte
|
|
||||||
---
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Tile } from "carbon-components-svelte";
|
import { Tile } from "carbon-components-svelte";
|
||||||
import Preview from "../../components/Preview.svelte";
|
import Preview from "../../components/Preview.svelte";
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
---
|
|
||||||
source: Notification/ToastNotification.svelte
|
|
||||||
---
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ToastNotification } from "carbon-components-svelte";
|
import { ToastNotification } from "carbon-components-svelte";
|
||||||
import Preview from "../../components/Preview.svelte";
|
import Preview from "../../components/Preview.svelte";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue