Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

Awesome Lists containing this project

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.