You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sidebar-form/README.md

76 lines
1.8 KiB

2 years ago
# Tiny Components - Sidebar Form
2 years ago
2 years ago
Created with [Riot.js](https://riot.js.org)
2 years ago
Handle Form in a Sidebar. Styles for Sidebar based on [Plain-UI](https://plain-ui.com).
## Changelog
2 years ago
0.1.0 Init
2 years ago
1.0.0 Remove "SidebarForm" and build a more basic Solution, that is also easier to adept
3 years ago
2 years ago
## Install
```
npm install @tiny-components\sidebar-form --save
```
## How to use
2 years ago
Create your own Component and add sidebarHeader & sidebarFooter,
2 years ago
```js
<div class={ getCssClasses() }>
<div class="sidebar__inner">
<!-- header -->
<tiny-sidebar-form-header title="{ !state.current.note ? 'New' : 'Edit' }" close={ (event) => { handleClose(event) }}></tiny-sidebar-form-header>
2 years ago
<div class="sidebar__form">
<form class="form" novalidate method="post" onsubmit={ (event) => { handleSubmit(event) } }>
<!-- body -->
<div class="sidebar__body">
<div class="field-group">
<label class="field-label">
Note
<textarea class="field-text" name="note"></textarea>
</label>
</div>
<!-- loading -->
<tiny-loading active={ state.isLoading }></tiny-loading>
</div>
<!-- footer -->
<tiny-sidebar-form-footer active={ state.isLoading }></tiny-sidebar-form-footer>
</form>
</div>
</div>
</div>
2 years ago
```
2 years ago
You have to add the Mixin "sidebarFormMixin.js".
```js
export default () => {
return {
...sidebar, // adding basic funtion for sidebar
```
Add Function to handle the submit.
```js
handleSubmit(event) {
event.preventDefault()
this.state.isLoading = true
this.update()
...
```
You can find a full Example in src/ and a running version under example/.