Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/haikyuu/imba-inertia-adapter
Inertia adapter for Imba.
https://github.com/haikyuu/imba-inertia-adapter
Last synced: 3 months ago
JSON representation
Inertia adapter for Imba.
- Host: GitHub
- URL: https://github.com/haikyuu/imba-inertia-adapter
- Owner: haikyuu
- License: mit
- Created: 2021-08-21T18:36:19.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-30T09:30:10.000Z (over 2 years ago)
- Last Synced: 2024-08-04T01:02:35.373Z (5 months ago)
- Language: TypeScript
- Size: 41 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-imba - Imba Inertia Adapter - Imba [Inertia](https://inertiajs.com) adapter. (Resources)
README
# Imba Inertia Adapter
## Install
- npm: `npm install imba-inertia-adapter`
- pnpm: `pnpm add imba-inertia-adapter`
- yarn : `yarn add imba-inertia-adapter`## Ping CRM implementation
https://github.com/haikyuu/perfect-stack## Full API docs
For more documentation, please refer to [inertia.js website](https://inertiajs.com). As the frontend adapters are quite similar in usage.## Usage
This will be the entry point for your app
```
import { createInertiaApp } from 'imba-inertia-adapter'createInertiaApp
resolve: do(name) name
setup: do({ el, App, props })
imba.mount <{App} props=props>
```## inertia-link and inertia-button-link
Those two components are automatically registered when you import from the main entry point.
They have the same attributes as their react/vue counterparts except `as` which is currently unsupported. Instead use the `inertia-button-link`.
```
"Logout"
"users"
```## Form Helper
```
import { Form } from 'imba-inertia-adapter'tag edit-contacts-page
prop props
def setup
const {last_name = "", first_name = ""} = props.contact;
self.form = new Form
first_name: first_name
last_name: last_name
def render
const {contact} = props
"Loading" if form.processing
"Submit"```
## Access the page object from deep down the tree
```
#context.currentPage.page.props
```## Flash messages
If your backend adapter supports them, they can be accessed like regular props
```
#context.currentPage.page.props.flash#or
props.flash
```## Notes
- You can change forms by simple assignment: `form.data.name = "Abdellah"`## License
MIT License.