-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an exemple of usage for the sticky table of content
- Loading branch information
Showing
5 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
packages/docs/components/molecules/StickyTableOfContent/examples.md
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,10 @@ | ||
--- | ||
outline: deep | ||
--- | ||
|
||
# Examples | ||
|
||
<PreviewPlayground | ||
:html="() => import('./stories/app.twig')" | ||
:script="() => import('./stories/app.js?raw')" | ||
/> |
11 changes: 11 additions & 0 deletions
11
packages/docs/components/molecules/StickyTableOfContent/index.md
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,11 @@ | ||
# StickyTable <Badges :texts="badges" /> | ||
|
||
<script setup> | ||
import pkg from '@studiometa/ui/molecules/StickyTable/package.json'; | ||
const badges = [`v${pkg.version}`, 'Twig']; | ||
</script> | ||
|
||
## Table of content | ||
|
||
- [Examples](./examples) | ||
- [Twig API](./twig-api) |
5 changes: 5 additions & 0 deletions
5
packages/docs/components/molecules/StickyTableOfContent/js-api.md
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,5 @@ | ||
--- | ||
title: Slider JS API | ||
--- | ||
|
||
# JS API (todo) |
33 changes: 33 additions & 0 deletions
33
packages/docs/components/molecules/StickyTableOfContent/stories/app.js
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,33 @@ | ||
/* eslint-disable max-classes-per-file */ | ||
import { Base, createApp } from '@studiometa/js-toolkit'; | ||
import { | ||
StickyTable as StickyTableCore, | ||
StickyTableItem, | ||
StickyTableSection, | ||
} from '@studiometa/ui'; | ||
|
||
/** | ||
* | ||
*/ | ||
class StickyTable extends StickyTableCore { | ||
static config = { | ||
components: { | ||
StickyTableItem, | ||
StickyTableSection, | ||
}, | ||
}; | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
class App extends Base { | ||
static config = { | ||
name: 'App', | ||
components: { | ||
StickyTable, | ||
}, | ||
}; | ||
} | ||
|
||
createApp(App, document.body); |
18 changes: 18 additions & 0 deletions
18
packages/docs/components/molecules/StickyTableOfContent/stories/app.twig
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,18 @@ | ||
<style type="text/css"> | ||
.current { | ||
color: red; | ||
} | ||
</style> | ||
|
||
<div data-component="StickyTable" class="flex items-start"> | ||
<div class="bg-blue-200 w-1/3 sticky top-4"> | ||
<div data-component="StickyTableItem" data-option-id="item-1"> item-1 </div> | ||
<div data-component="StickyTableItem" data-option-id="item-2"> item-2</div> | ||
<div data-component="StickyTableItem" data-option-id="item-3"> item-3</div> | ||
</div> | ||
<div data-component="StickyTableSection" class="bg-green-200 w-2/3 h-[300vh]"> | ||
<div class="h-1/3" data-ref="item[]" id="item-1">Item1</div> | ||
<div class="h-1/3" data-ref="item[]" id="item-2">Item2</div> | ||
<div class="h-1/3" data-ref="item[]" id="item-3">Item3</div> | ||
</div> | ||
</div> |