Skip to content

Commit 64feb6f

Browse files
committed
Updated README
1 parent feae259 commit 64feb6f

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ composer require whitecube/bem-components
1212

1313
## Usage
1414

15-
Generate your component files as you are used to, then add the `Whitecube\BemComponents\HasBemClasses` trait to their controller class in `App\View\Components`:
15+
Generate your component files as you are used to, then add the `Whitecube\BemComponents\HasBemClasses` trait to the component's view controller in `App\View\Components`:
1616

1717
```php
1818
<?php
@@ -55,7 +55,7 @@ Then, don't forget to echo `$attributes->bem(string $base, string|array $extraMo
5555
</a>
5656
```
5757

58-
Now you can pass modifiers and classes as you please:
58+
You can now pass modifiers and classes as you please:
5959

6060
```blade
6161
<x-btn href="#" modifier="big">Click me!</x-btn>
@@ -89,7 +89,7 @@ Now you can pass modifiers and classes as you please:
8989

9090
#### `$bem(string $base, string|array $modifiers = []): string`
9191

92-
Get compiled BEM classes with modifiers. The modifiers parameter can either be a string of space-separated modifiers, or an array.
92+
Get compiled BEM classes with modifiers. The `modifiers` parameter can either be a string of space-separated modifiers or an array.
9393

9494
For example, calling:
9595
```php
@@ -106,9 +106,10 @@ btn__label btn__label--blue btn__label--bold
106106

107107
#### `$hasModifier(string $modifier): bool`
108108

109-
Checks if the specified modifier is applied on this component.
109+
Checks if the specified `modifier` is applied on this component.
110110

111-
> Warning: this method is also available inside the `Component` instance (using `$this->hasModifier(string $modifier)`) but unfortunately it is not able to check for modifiers defined as attributes on the component's tag (`<x-component modifiers="foo bar" />`) as of Laravel 10.x, because these values are not exposed before rendering the component's view. Let's hope this restriction will be lifted in the future.
111+
> [!IMPORTANT]
112+
> This method is also available inside the `Component` instance (using `$this->hasModifier(string $modifier)`) but unfortunately it is not able to check for modifiers defined as attributes on the component's tag (`<x-component modifiers="foo bar" />`) as of Laravel 10.x, because these values are not exposed before rendering the component's view. Let's hope this restriction will be lifted in the future.
112113
113114
If you need to access these modifiers inside the `Component` instance, you can always request them from the component's `__construct` parameters and inject them manually:
114115

@@ -128,9 +129,10 @@ public function __construct(null|string|array $modifiers = [])
128129

129130
#### `$hasClass(string $classname): bool`
130131

131-
Checks if the specified class is applied on this component.
132+
Checks if the specified CSS classname is applied on this component.
132133

133-
> Warning: this method is also available inside the `Component` instance (using `$this->hasClass(string $classname)`) but unfortunately it is not able to check for classnames defined as attributes on the component's tag (`<x-component class="foo bar" />`) as of Laravel 10.x, because these values are not exposed before rendering the component's view. Let's hope this restriction will be lifted in the future.
134+
> [!IMPORTANT]
135+
> This method is also available inside the `Component` instance (using `$this->hasClass(string $classname)`) but unfortunately it is not able to check for classnames defined as attributes on the component's tag (`<x-component class="foo bar" />`) as of Laravel 10.x, because these values are not exposed before rendering the component's view. Let's hope this restriction will be lifted in the future.
134136
135137
If you need to access these classnames inside the `Component` instance, you can always request them from the component's `__construct` parameters and inject them manually:
136138

0 commit comments

Comments
 (0)