From 4881f79fd13ab2d672eed819b26a29ff77ef4c6f Mon Sep 17 00:00:00 2001 From: Vaggelis Yfantis Date: Wed, 26 Aug 2020 23:14:56 +0300 Subject: [PATCH] wip --- DOCUMENTATION.md | 8 -------- README.md | 40 ++++++++++++++++++++++++++++++------- src/Tags/BladeComponent.php | 4 +++- 3 files changed, 36 insertions(+), 16 deletions(-) delete mode 100644 DOCUMENTATION.md diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md deleted file mode 100644 index b378e8b..0000000 --- a/DOCUMENTATION.md +++ /dev/null @@ -1,8 +0,0 @@ -## Installation - -1. Install via Composer `composer require octoper/statamic-blade-components` -2. Enjoy! - -## Usage - -A Laravel Blade component integration for Statamics Antlers template engine. diff --git a/README.md b/README.md index 7ffd3bd..7ccac17 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,40 @@ -# statamic-blade-components +# Statamic Blade Components ![Statami v3](https://img.shields.io/badge/Statamic-3.0+-FF269E) ![Packagist](https://img.shields.io/packagist/v/octoper/statamic-blade-components) ![Test Suite](https://github.com/octoper/statamic-blade-components/workflows/Test%20Suite/badge.svg) -A Laravel Blade component integration for Statamics Antlers template engine. +A [Laravel Blade Components](https://laravel.com/docs/7.x/blade#components) integration for Statamics Antlers template engine. -## Documentation -[Read](./DOCUMENTATION.md) this addon's documentation. +## Installation +Pull in your package with composer +```bash +composer require octoper/statamic-blade-components +``` -## Resources -* [Statamic 3 Docs](https://statamic.dev) -* [Statamic Discord](https://statamic.com/discord) +## General documentation +[Laravel Blade Components](https://laravel.com/docs/7.x/blade#components) + +## How to be used with the Antlers template engine +```html +{{ component:hello }} +``` + +### Passing Initial Parameters +You can pass data into a component by passing additional parameters + +```html +{{ component:avatar username="johndoe" }} +``` + +### Passing Slots +You can pass additional content to your component via "slots" too. + +```html +{{ component:label for="email" }} +Email +{{ /component }} +``` ## Security @@ -21,3 +44,6 @@ If you discover any security related issues, please email me@octoper.me instead - [Vaggelis Yfantis](https://github.com/octoper) - [All Contributors](../../contributors) + +# License +This plugin is published under the MIT license. Feel free to use it and remember to spread love. diff --git a/src/Tags/BladeComponent.php b/src/Tags/BladeComponent.php index 75afa57..1146f9f 100644 --- a/src/Tags/BladeComponent.php +++ b/src/Tags/BladeComponent.php @@ -15,7 +15,9 @@ class BladeComponent extends Tags { - protected static $handle = 'x'; + protected static $handle = 'component'; + + protected static $aliases = ['x']; public function wildcard(string $expression): string {