-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: simplify routes structure (kitbook will automatically updates ro…
…utes as needed according to future changes) * feat: add buttons to create variants and markdown files from kitbook
- Loading branch information
Showing
58 changed files
with
472 additions
and
458 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 |
---|---|---|
@@ -1,5 +1,2 @@ | ||
- [ ] Lint the project with `pnpm lint` | ||
|
||
### Changesets | ||
|
||
- [ ] If your PR makes a change that should be noted in the changelogs, generate a changeset by running `pnpx changeset` and following the prompts. | ||
- [ ] Write your commits using [Convential Commits](https://www.conventionalcommits.org/en/v1.0.0/). |
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
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
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
39 changes: 39 additions & 0 deletions
39
packages/kitbook/src/docs/2-compositions/BottomSheet.example.composition
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,39 @@ | ||
<script lang="ts"> | ||
import { ShowHide, Button, BottomSheet } from "svelte-pieces"; | ||
|
||
export let max = 10 | ||
export let start = 40 | ||
export let contentHeight = 500 | ||
export let duration = 150 | ||
</script> | ||
|
||
<ShowHide let:show let:toggle> | ||
<Button size="sm" onclick={toggle} form="filled">Toggle Show</Button> | ||
<Button size="sm" onclick={() => { max = 10}} active={max === 10}>Top max</Button> | ||
<Button size="sm" onclick={() => { max = 40}} active={max === 40}>Middle max</Button> | ||
<Button size="sm" onclick={() => { max = 85}} active={max === 85}>Bottom max</Button> | ||
<Button size="sm" onclick={() => { start = 10}} active={start === 10}>Top Start</Button> | ||
<Button size="sm" onclick={() => { start = 40}} active={start === 40}>Middle Start</Button> | ||
<Button size="sm" onclick={() => { start = 85}} active={start === 85}>Bottom Start</Button> | ||
<Button size="sm" onclick={() => { contentHeight = 500}} active={contentHeight === 500}>Tall Content</Button> | ||
<Button size="sm" onclick={() => { contentHeight = 250}} active={contentHeight === 250}>Med Content</Button> | ||
<Button size="sm" onclick={() => { contentHeight = 100}} active={contentHeight === 100}>Short Content</Button> | ||
{#if show} | ||
<BottomSheet on:close={toggle} {max} {start} {duration}> | ||
<div slot="header"> | ||
Title | ||
<Button | ||
size="sm" | ||
form="simple" | ||
onclick={() => { contentHeight = 250}} | ||
active={contentHeight === 250}>Med Content</Button> | ||
<Button | ||
size="sm" | ||
form="simple" | ||
onclick={() => { contentHeight = 100}} | ||
active={contentHeight === 100}>Short Content</Button> | ||
</div> | ||
<p class="bg-gray-100" style="height: {contentHeight}px">Content</p> | ||
</BottomSheet> | ||
{/if} | ||
</ShowHide> |
80 changes: 80 additions & 0 deletions
80
packages/kitbook/src/docs/2-compositions/EarthquakeClusters.example.composition
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,80 @@ | ||
<script lang="ts"> | ||
// @ts-expect-error | ||
import Map from '$lib/maps/mapbox/map/Map.svelte'; | ||
// @ts-expect-error | ||
import GeoJSONSource from '$lib/maps/mapbox/sources/GeoJSONSource.svelte'; | ||
// @ts-expect-error | ||
import Layer from '$lib/maps/mapbox/map/Layer.svelte'; | ||
|
||
// export let height = 350; | ||
const clustersId = 'clusters'; | ||
</script> | ||
|
||
<Map let:map> | ||
<GeoJSONSource | ||
data="https://docs.mapbox.com/mapbox-gl-js/assets/earthquakes.geojson" | ||
options={{ cluster: true, clusterMaxZoom: 14, clusterRadius: 50 }} | ||
let:source | ||
> | ||
<Layer | ||
id={clustersId} | ||
options={{ | ||
type: 'circle', | ||
filter: ['has', 'point_count'], | ||
paint: { | ||
'circle-color': [ | ||
'step', | ||
['get', 'point_count'], | ||
'#51bbd6', | ||
100, | ||
'#f1f075', | ||
750, | ||
'#f28cb1', | ||
], | ||
'circle-radius': ['step', ['get', 'point_count'], 20, 100, 30, 750, 40], | ||
}, | ||
}} | ||
on:click={({ detail }) => { | ||
const features = map.queryRenderedFeatures(detail.point, { | ||
layers: [clustersId], | ||
}); | ||
const clusterId = features[0].properties.cluster_id; | ||
source.getClusterExpansionZoom(clusterId, (err, zoom) => { | ||
if (err) return; | ||
map.easeTo({ | ||
center: features[0].geometry.coordinates, | ||
zoom, | ||
}); | ||
}); | ||
}} | ||
on:mouseenter={() => (map.getCanvas().style.cursor = 'pointer')} | ||
on:mouseleave={() => (map.getCanvas().style.cursor = '')} | ||
/> | ||
<Layer | ||
options={{ | ||
type: 'symbol', | ||
filter: ['has', 'point_count'], | ||
layout: { | ||
'text-field': '{point_count_abbreviated}', | ||
'text-font': ['DIN Offc Pro Medium', 'Arial Unicode MS Bold'], | ||
'text-size': 12, | ||
}, | ||
}} | ||
/> | ||
<Layer | ||
options={{ | ||
type: 'circle', | ||
filter: ['!', ['has', 'point_count']], | ||
paint: { | ||
'circle-color': '#11b4da', | ||
'circle-radius': 4, | ||
'circle-stroke-width': 1, | ||
'circle-stroke-color': '#fff', | ||
}, | ||
}} | ||
on:click={() => alert('point clicked')} | ||
on:mouseenter={() => (map.getCanvas().style.cursor = 'pointer')} | ||
on:mouseleave={() => (map.getCanvas().style.cursor = '')} | ||
/> | ||
</GeoJSONSource> | ||
</Map> |
21 changes: 21 additions & 0 deletions
21
packages/kitbook/src/docs/2-compositions/complex-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,21 @@ | ||
## Complex User Interaction | ||
|
||
**NOTE: This page is in construction as compositions are under construction - you can ignore it for now.** | ||
|
||
Sometimes building components is more about testing interaction than they are about mocking various component states. In the `BottomSheet` component found in the [svelte-pieces](https://github.com/jacob-8/kitbook/tree/main/packages/svelte-pieces) package also in this monorepo. A Story component was set up that allowed for quick adjustment of some opening height props such that the component can be tested in a variety of conditions. | ||
|
||
[[./BottomSheet.example.composition]] | ||
|
||
Note especially the use of the helper `ShowHide` component. As a Story is just Svelte, you can do anything, even use `setContext` in your stories file. | ||
|
||
## Conglomeration of many components | ||
|
||
Sometimes you may want to prototype an arrangement of multiple components together. The following example combines a `Map`, `GeoJSONSource`, and `Layer` component from the [Living Dictionaries repo](https://github.com/livingtongues/living-dictionaries) into a display of earthquake clusters. | ||
|
||
|
||
[[./EarthquakeClusters.example.composition]] | ||
|
||
[//begin]: # "Autogenerated link references for markdown compatibility" | ||
[./BottomSheet.example.composition]: BottomSheet.example.composition "BottomSheet.example" | ||
[./EarthquakeClusters.example.composition]: EarthquakeClusters.example.composition "EarthquakeClusters.example" | ||
[//end]: # "Autogenerated link references" |
130 changes: 0 additions & 130 deletions
130
packages/kitbook/src/docs/2-compositions/complex-examples.txt
This file was deleted.
Oops, something went wrong.
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
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
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
Oops, something went wrong.
d668e6c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
kitbook-template – ./packages/template
kitbook-template.vercel.app
kitbook-template-polylingual.vercel.app
kitbook-template-git-main-polylingual.vercel.app
d668e6c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
kitbook – ./packages/kitbook
kitbook-git-main-polylingual.vercel.app
kitbook.vercel.app
kitbook-polylingual.vercel.app