-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): add live code tab layout component
- Loading branch information
Showing
2 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
// See https://astro-live-code.vercel.app/guides/customization/ | ||
// | ||
// Layouts can be specified for a specific code block by adding a layout attribute to the code block: | ||
// ```tsx layout="~/components/live-code-tab-layout.astro" | ||
import { Tabs, TabItem } from '@astrojs/starlight/components'; | ||
--- | ||
|
||
<Tabs> | ||
<TabItem label="Preview" > | ||
<div class="example-container"> | ||
<slot name="example" /> | ||
</div> | ||
</TabItem> | ||
<TabItem label="Code"> | ||
<slot name="code" /> | ||
</TabItem> | ||
</TabItem> | ||
|
||
<style> | ||
.live-code-layout { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.example-container { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
padding: 2.5rem; | ||
background: var(--ec-frm-edBg, var(--astro-code-color-background)); | ||
border-style: solid; | ||
border-width: var(--ec-brdWd, 1px); | ||
border-color: var(--ec-brdCol, var(--sl-color-gray-5)); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters