Skip to content

Commit

Permalink
ref: headles inertable
Browse files Browse the repository at this point in the history
  • Loading branch information
rizkhal committed Apr 1, 2022
1 parent 386791b commit adee1db
Show file tree
Hide file tree
Showing 36 changed files with 197 additions and 827 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check & fix styling

on: [push]

jobs:
php-cs-fixer:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php-cs-fixer.php --allow-risky=yes

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix styling
41 changes: 41 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

$finder = Symfony\Component\Finder\Finder::create()
->notPath('resources/**/*')
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->name('*.php')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true);

$config = new PhpCsFixer\Config();
return $config->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'trailing_comma_in_multiline' => true,
'phpdoc_scalar' => true,
'unary_operator_spaces' => true,
'binary_operator_spaces' => true,
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_var_without_name' => true,
'class_attributes_separation' => [
'elements' => [
'method' => 'one',
],
],
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
],
'single_trait_insert_per_statement' => false,
])
->setFinder($finder);
82 changes: 6 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
![Package Logo](https://banners.beyondco.de/INERTABLE.png?theme=light&packageManager=composer+require&packageName=rizkhal%2Finertable&pattern=jigsaw&style=style_1&description=A+Simple+Datatable+For+Laravel+Using+Inertia3+%26+Vue3&md=1&showWatermark=0&fontSize=100px&images=table&widths=auto)
![Package Logo](https://banners.beyondco.de/INERTABLE.png?theme=light&packageManager=composer+require&packageName=rizkhal%2Finertable&pattern=jigsaw&style=style_1&description=A+Headles+datatable+for+Laravel+with+Inertia&md=1&showWatermark=0&fontSize=100px&images=table&widths=auto)

<p align="center">

<a href="https://github.com/rizkhal/inertable/actions/workflows/tests.yml/badge.svg">
<img alt="GitHub last commit" src="https://github.com/rizkhal/inertable/actions/workflows/tests.yml/badge.svg">
</a>

<a href="https://github.com/rizkhal/inertable/actions/workflows/php-cs-fixer.yml/badge.svg">
<img alt="GitHub cs fixer" src="https://github.com/rizkhal/inertable/actions/workflows/php-cs-fixer.yml/badge.svg">
</a>

<a href="https://img.shields.io/github/last-commit/rizkhal/inertable?style=plastic">
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/rizkhal/inertable">
</a>
Expand All @@ -18,13 +22,9 @@
<img alt="Packagist Version" src="https://img.shields.io/packagist/v/rizkhal/inertable">
</a>

<a href="https://img.shields.io/npm/v/@rizkhal/inertable-vue">
<img alt="Npm Version" src="https://img.shields.io/npm/v/@rizkhal/inertable-vue">
</a>

</p>

## SERVER SIDE INSTALATION
## INSTALATION

```bash
composer require rizkhal/inertable
Expand Down Expand Up @@ -69,73 +69,3 @@ class UserTable extends Inertable
}
}
```

## CLIENT SIDE INSTALLATION

Using NPM

```bash
npm install @rizkhal/inertable-vue
```

Or YARN

```bash
yarn add @rizkhal/inertable-vue
```

Setup in `app.js`

```js
import inertable from "@rizkhal/inertable-vue";

// ...
app.use(inertable);
```

Usage in component or page

```vue
<template>
<div class="mx-auto max-w-7xl py-10 px-5">
<v-inertable :inertable="props.inertable" :actions="actions" @onAdd="handleOnAdd">
<template #action>
<button class="rounded bg-red-500 py-1 px-2 text-white focus:ring-2 focus:ring-red-500 focus:ring-offset-2">Delete</button>
</template>
</v-inertable>
</div>
</template>
<script setup>
import actions from "./actions.json";
const props = defineProps({
inertable: Object,
});
const handleOnAdd = () => {
console.log("on add triggered");
};
</script>
```

The `actions.json` just a simple array of object to generate button for handle your modal button to add data or something else

```json
[
{
"text": "New User",
"icon": "PlusSmIcon",
"emit": "onAdd"
}
]
```

You can also using `slots` to make it

```vue
<v-inertable :inertable="props.inertable">
<template #actions>
<!-- add your buttons here -->
</template>
</v-inertable>
```
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
"license": "MIT",
"autoload": {
"psr-4": {
"Rizkhal\\Inertable\\": "php/"
"Rizkhal\\Inertable\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Rizkhal\\Inertable\\Tests\\": "php/tests"
"Rizkhal\\Inertable\\Tests\\": "tests/"
}
},
"extra": {
Expand Down
Loading

0 comments on commit adee1db

Please sign in to comment.