-
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.
- Loading branch information
Showing
30 changed files
with
711 additions
and
12 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
title: Action examples | ||
--- | ||
|
||
# Examples | ||
|
||
## Close modals and panels | ||
|
||
<PreviewPlayground | ||
:html="() => import('./stories/close-modal-and-panel/app.twig')" | ||
:script="() => import('./stories/close-modal-and-panel/app.js?raw')" | ||
/> |
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,43 @@ | ||
# Action <Badges :texts="badges" /> | ||
|
||
<script setup> | ||
import pkg from '@studiometa/ui/atoms/Action/package.json'; | ||
|
||
const badges = [`v${pkg.version}`, 'JS']; | ||
</script> | ||
|
||
The `Action` atom is a component who trigger an action on specified components. | ||
|
||
## Table of content | ||
|
||
- [Examples](./examples) | ||
- [JS API](./js-api) | ||
|
||
## Usage | ||
|
||
This component can be directly imported and defined as a dependency of your application: | ||
|
||
```js {2,8} | ||
import { Base, createApp } from '@studiometa/js-toolkit'; | ||
import { Action } from '@studiometa/ui'; | ||
|
||
class App extends Base { | ||
static config = { | ||
name: 'App', | ||
components: { | ||
Action, | ||
}, | ||
}; | ||
} | ||
``` | ||
|
||
```html | ||
<button | ||
type="button" | ||
data-component="Action" | ||
data-option-target="Panel Modal" | ||
data-option-selector=".can-be-closed" | ||
data-option-method="close"> | ||
Close every panel & modal with .can-be-closed class | ||
</button> | ||
``` |
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,35 @@ | ||
--- | ||
title: Action JS API | ||
--- | ||
|
||
# JS API | ||
|
||
## Options | ||
|
||
### `on` | ||
|
||
- Type: `string` | ||
- Default: `'click'` | ||
|
||
Use this option to change the listened event. | ||
|
||
### `target` | ||
|
||
- Type: `string` | ||
- Required | ||
|
||
Use this option to set the name of the components that you want to target. You can target multiple components if you separate the names by a space. | ||
|
||
### `method` | ||
|
||
- Type: `string` | ||
- Required | ||
|
||
Use this option to set the method name that will be triggered on the targeted components. | ||
|
||
### `selector` | ||
|
||
- Type: `string` | ||
- Default: `null` | ||
|
||
Use this option to filter the targeted components. |
15 changes: 15 additions & 0 deletions
15
packages/docs/components/atoms/Action/stories/close-modal-and-panel/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,15 @@ | ||
import { Base, createApp } from '@studiometa/js-toolkit'; | ||
import { Action, Modal, Panel } from '@studiometa/ui'; | ||
|
||
class App extends Base { | ||
static config = { | ||
name: 'App', | ||
components: { | ||
Modal, | ||
Panel, | ||
Action, | ||
}, | ||
}; | ||
} | ||
|
||
export default createApp(App, document.body); |
58 changes: 58 additions & 0 deletions
58
packages/docs/components/atoms/Action/stories/close-modal-and-panel/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,58 @@ | ||
{% include '@ui/atoms/Button/StyledButton.twig' with { | ||
label: 'Close Panel & Modal with [data-can-be-closed]', | ||
attr: { | ||
class: 'relative z-50', | ||
data_component: 'Action', | ||
data_option_on: 'click', | ||
data_option_target: 'Modal Panel', | ||
data_option_method: 'close', | ||
data_option_selector: '[data-can-be-closed]', | ||
} | ||
} %} | ||
|
||
<div class="w-full h-screen flex items-center justify-center p-10"> | ||
{% embed '@ui/molecules/Modal/StyledModal.twig' with { | ||
attr: { | ||
data_can_be_closed: true, | ||
} | ||
} %} | ||
{% block content %} | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim | ||
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex <a href="#"> | ||
ea commodo consequat | ||
</a>. Duis aute irure dolor in reprehenderit in voluptate velit esse | ||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat | ||
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim | ||
id est laborum. | ||
</p> | ||
{% endblock %} | ||
{% endembed %} | ||
{% embed '@ui/molecules/Panel/StyledPanel.twig' | ||
with { | ||
attr: { | ||
data_can_be_closed: true, | ||
}, | ||
position: 'right', | ||
wrapper_attr: { class: 'p-10' }, | ||
container_attr: { class: 'max-w-lg mb-auto rounded' }, | ||
content_attr: { class: 'p-4' } | ||
} | ||
%} | ||
{% block content %} | ||
<div class="mb-4"> | ||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do | ||
eiusmod. | ||
</div> | ||
|
||
{% include '@ui/atoms/Button/StyledButton.twig' with { | ||
label: 'Ok', | ||
attr: { data_ref: 'close[]' } | ||
} %} | ||
{% endblock %} | ||
{% block close %} | ||
|
||
{% endblock %} | ||
{% endembed %} | ||
</div> |
31 changes: 31 additions & 0 deletions
31
packages/docs/components/atoms/CircularMarquee/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,31 @@ | ||
# Examples | ||
|
||
## Default | ||
<PreviewPlayground | ||
:html="() => import('./stories/app.twig')" | ||
:script="() => import('./stories/app.js?raw')" | ||
/> | ||
|
||
## Higher sensitivity | ||
<PreviewPlayground | ||
:html="() => import('./stories/app-2.twig')" | ||
:script="() => import('./stories/app.js?raw')" | ||
/> | ||
|
||
## Negative sensitivity | ||
<PreviewPlayground | ||
:html="() => import('./stories/app-3.twig')" | ||
:script="() => import('./stories/app.js?raw')" | ||
/> | ||
|
||
## Exemple with same `outer_radius` and `radius` | ||
|
||
:::tip Why is there two radius parameters ? | ||
- `outer_radius` set the size of the **svg viewbox**. `radius` set the size of the `<path>` on which the circular text will be written. | ||
- `outer_radius` needs to be greater in order to **avoid cutting** the text since the `<svg>` will always hide the overflowing content. | ||
::: | ||
|
||
<PreviewPlayground | ||
:html="() => import('./stories/app-4.twig')" | ||
:script="() => import('./stories/app.js?raw')" | ||
/> |
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,47 @@ | ||
--- | ||
outline: deep | ||
--- | ||
|
||
# CircularMarquee <Badges :texts="badges" /> | ||
|
||
<script setup> | ||
import pkg from '@studiometa/ui/atoms/Button/package.json'; | ||
|
||
const badges = [`v${pkg.version}`, 'Twig']; | ||
</script> | ||
|
||
Use this component to create CircularMarquee, a spinning on scroll circular text. This is made using the `<svg>` capabilities. | ||
|
||
## Table of content | ||
|
||
- [Examples](./examples.md) | ||
- [Twig API](./twig-api.md) | ||
|
||
## Usage | ||
|
||
Once the [package installed](/guide/installation/), simply include the Twig template and load the JavaScript component in your project: | ||
|
||
```twig | ||
{% include '@ui-pkg/atoms/CircularMarquee/CircularMarquee.twig' with { | ||
id: 'unique-id', | ||
radius: 120, | ||
outer_radius: 150, | ||
content: ' My text content' | ||
} only %} | ||
``` | ||
|
||
```js | ||
import { Base, createApp } from '@studiometa/js-toolkit'; | ||
import { CircularMarquee } from '@studiometa/ui'; | ||
|
||
class App extends Base { | ||
static config = { | ||
name: 'App', | ||
components: { | ||
CircularMarquee, | ||
}, | ||
}; | ||
} | ||
|
||
export default createApp(Base); | ||
``` |
18 changes: 18 additions & 0 deletions
18
packages/docs/components/atoms/CircularMarquee/stories/app-2.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 @@ | ||
<div class="flex items-center justify-center h-48"> | ||
Scroll down | ||
</div> | ||
<div class="h-screen overflow-hidden"> | ||
<div style="height: 400vh"> | ||
{% include '@ui/atoms/CircularMarquee/CircularMarquee.twig' with { | ||
id: 'fraicheur', | ||
sensitivity: 0.9, | ||
radius: 120, | ||
outer_radius: 150, | ||
content: ' Douceur • Fraîcheur • Douceur • Fraîcheur • Douceur • Fraîcheur • ' | ||
} only %} | ||
</div> | ||
</div> | ||
</div> | ||
<div class="flex items-center justify-center h-screen"> | ||
Scroll up | ||
</div> |
17 changes: 17 additions & 0 deletions
17
packages/docs/components/atoms/CircularMarquee/stories/app-3.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,17 @@ | ||
<div class="flex items-center justify-center h-48"> | ||
Scroll down | ||
</div> | ||
<div class="h-screen overflow-hidden"> | ||
<div style="height: 400vh"> | ||
{% include '@ui/atoms/CircularMarquee/CircularMarquee.twig' with { | ||
id: 'fraicheur', | ||
sensitivity: - 1 * 0.3, | ||
radius: 120, | ||
outer_radius: 150, | ||
content: ' Douceur • Fraîcheur • Douceur • Fraîcheur • Douceur • Fraîcheur • ' | ||
} only %} | ||
</div> | ||
</div> | ||
<div class="flex items-center justify-center h-screen"> | ||
Scroll up | ||
</div> |
15 changes: 15 additions & 0 deletions
15
packages/docs/components/atoms/CircularMarquee/stories/app-4.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,15 @@ | ||
<div class="flex items-center justify-center h-48"> | ||
Scroll down | ||
</div> | ||
<div class="h-screen overflow-hidden"> | ||
{% include '@ui/atoms/CircularMarquee/CircularMarquee.twig' with { | ||
id: 'douceur', | ||
radius: 120, | ||
outer_radius: 120, | ||
content: ' Douceur • Fraîcheur • Douceur • Fraîcheur • Douceur • Fraîcheur • ' | ||
} only %} | ||
</div> | ||
</div> | ||
<div class="flex items-center justify-center h-screen"> | ||
Scroll up | ||
</div> |
13 changes: 13 additions & 0 deletions
13
packages/docs/components/atoms/CircularMarquee/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,13 @@ | ||
import { Base, createApp } from '@studiometa/js-toolkit'; | ||
import { CircularMarquee } from '@studiometa/ui'; | ||
|
||
class App extends Base { | ||
static config = { | ||
name: 'App', | ||
components: { | ||
CircularMarquee, | ||
}, | ||
}; | ||
} | ||
|
||
export default createApp(App, document.body); |
Oops, something went wrong.