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 components = [component];
|
||||
export let source = "";
|
||||
export let unreleased = 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
|
||||
$: sourceCode = `https://github.com/carbon-design-system/carbon-components-svelte/tree/master/src/${
|
||||
source || `${$page.title}/${$page.title}.svelte`
|
||||
}`;
|
||||
$: sourceCode = `https://github.com/carbon-design-system/carbon-components-svelte/tree/master/${formatSourceURL(
|
||||
multiple
|
||||
)}`;
|
||||
</script>
|
||||
|
||||
<Content data-components>
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
---
|
||||
source: Button/ButtonSet.svelte
|
||||
---
|
||||
|
||||
<script>
|
||||
import { Button, ButtonSet } from "carbon-components-svelte";
|
||||
import Login from "carbon-icons-svelte/lib/Login.svelte";
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
---
|
||||
source: Tile/ClickableTile.svelte
|
||||
---
|
||||
|
||||
<script>
|
||||
import { ClickableTile } from "carbon-components-svelte";
|
||||
import Preview from "../../components/Preview.svelte";
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
---
|
||||
source: Tile/ExpandableTile.svelte
|
||||
---
|
||||
|
||||
<script>
|
||||
import { ExpandableTile, Button } from "carbon-components-svelte";
|
||||
import Preview from "../../components/Preview.svelte";
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
components: ["InlineNotification", "NotificationActionButton"]
|
||||
source: Notification/InlineNotification.svelte
|
||||
---
|
||||
|
||||
<script>
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
---
|
||||
source: TextInput/PasswordInput.svelte
|
||||
---
|
||||
|
||||
<script>
|
||||
import { PasswordInput } from "carbon-components-svelte";
|
||||
import Preview from "../../components/Preview.svelte";
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
components: ["TileGroup", "RadioTile"]
|
||||
source: Tile/RadioTile.svelte
|
||||
---
|
||||
|
||||
<script>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
components: ["SelectableTile"]
|
||||
source: Tile/SelectableTile.svelte
|
||||
---
|
||||
|
||||
<script>
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
---
|
||||
source: Tile/Tile.svelte
|
||||
---
|
||||
|
||||
<script>
|
||||
import { Tile } from "carbon-components-svelte";
|
||||
import Preview from "../../components/Preview.svelte";
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
---
|
||||
source: Notification/ToastNotification.svelte
|
||||
---
|
||||
|
||||
<script>
|
||||
import { ToastNotification } from "carbon-components-svelte";
|
||||
import Preview from "../../components/Preview.svelte";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue