Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added buttons | Update screenshots | Update readme #1

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .github/media/buttons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .github/media/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 53 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

This package includes some Tailwind CSS styled Blade components, the components do not need or require Rapidez. This package is only used within Rapidez by default, but **can be used in any Laravel project**.

### Inputs

- [Input](https://github.com/rapidez/blade-components/blob/master/resources/views/components/input/index.blade.php)
- [Checkbox](https://github.com/rapidez/blade-components/blob/master/resources/views/components/input/checkbox/index.blade.php)
- [Radio](https://github.com/rapidez/blade-components/blob/master/resources/views/components/input/radio/index.blade.php)
Expand All @@ -15,6 +17,22 @@ We don't provide a input + label combination component as you'll end up with att

![](.github/media/screenshot.png)

### Buttons

- [Base](https://github.com/rapidez/blade-components/blob/master/resources/views/components/button/base.blade.php)
- [Index](https://github.com/rapidez/blade-components/blob/master/resources/views/components/button/index.blade.php)
- [Primary](https://github.com/rapidez/blade-components/blob/master/resources/views/components/button/primary.blade.php)
- [Secondary](https://github.com/rapidez/blade-components/blob/master/resources/views/components/button/secondary.blade.php)
- [Outline](https://github.com/rapidez/blade-components/blob/master/resources/views/components/button/outline.blade.php)
- [Enhanced](https://github.com/rapidez/blade-components/blob/master/resources/views/components/button/enhanced.blade.php)
- [Slider](https://github.com/rapidez/blade-components/blob/master/resources/views/components/button/slider.blade.php)

The base button doesn't have any styling; here, we only use the `x-tag`.
All other buttons use the `button/index`, which contains the basic styling for buttons, such as padding, hover effects, and the disabled state.
The button variants contain styling for the background and text color. There is only one exception: the `button/slider`, which has more custom styling than the other button variants.

![](.github/media/buttons.png)

## Installation

```
Expand All @@ -24,10 +42,21 @@ composer require rapidez/blade-components
And make sure these colors are present in your Tailwind config:
```js
colors: {
neutral: '#334155',
inactive: '#64748b',
border: '#e7ebef',
disabled: '#ebe8de',
colors: {
primary: {
DEFAULT: '#2FBC85',
text: '#FFFFFF',
Roene-JustBetter marked this conversation as resolved.
Show resolved Hide resolved
},
secondary: {
DEFAULT: '#F97316',
text: '#FFFFFF',
},
neutral: '#334155',
inactive: '#64748B',
border: '#E7EBEF',
disabled: '#EBE8DE',
enhanced: '#36B422'
Comment on lines +54 to +58
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking forward to the final version of this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be a follow up based on the feedback here: rapidez/core#580. I will create a new PR so we can see the difference between both PR's

}
}
```

Expand Down Expand Up @@ -61,6 +90,26 @@ Just like any other Blade component, check out the [Laravel Blade docs](https://
</x-rapidez::input.checkbox>
```

## x-tag

It is a Blade version of a [dynamic Vue component](https://vuejs.org/guide/essentials/component-basics.html#dynamic-components)

### Usage

```blade
<x-tag is="span" class="font-bold">
Something
</x-tag>
```

which will result in

```html
<span class="font-bold">
Something
</span>
```

## Preview

There is a preview Blade file included with all the components, to view that in your project you could register a route for it within `routes/web.php` and visit the `/components` route from your browser:
Expand Down
32 changes: 27 additions & 5 deletions resources/views/components-preview.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.tailwindcss.com?plugins=forms"></script>

<title>Preview</title>

Expand All @@ -12,10 +12,19 @@
theme: {
extend: {
colors: {
primary: {
DEFAULT: '#2FBC85',
text: '#FFFFFF',
},
secondary: {
DEFAULT: '#F97316',
text: '#FFFFFF',
},
neutral: '#334155',
inactive: '#64748b',
border: '#e7ebef',
disabled: '#ebe8de',
inactive: '#64748B',
border: '#E7EBEF',
disabled: '#EBE8DE',
enhanced: '#36B422'
}
}
}
Expand Down Expand Up @@ -142,7 +151,20 @@
</div>

<h2 class="font-bold text-lg">Button components</h2>
Soon...
<div class="grid grid-cols-5 gap-5">
<x-rapidez::button>Default</x-rapidez::button>
<x-rapidez::button.primary>Primary</x-rapidez::button.primary>
<x-rapidez::button.secondary>Secondary</x-rapidez::button.secondary>
<x-rapidez::button.outline>Outline</x-rapidez::button.outline>
<x-rapidez::button.enhanced>Enhanced</x-rapidez::button.enhanced>
<div class="flex flex-col gap-2">
<strong>Slider:</strong>
<div class="flex items-center gap-2">
<x-rapidez::button.slider><</x-rapidez::button.slider>
<x-rapidez::button.slider>></x-rapidez::button.slider>
</div>
</div>
</div>

<h2 class="font-bold text-lg">Slideover component</h2>
Soon...
Expand Down
30 changes: 30 additions & 0 deletions resources/views/components/button/base.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{--
This is the base for all the buttons. In here we don't need classes.
If you want to change styling for buttons go to the button/index.
<x-tag> Is a dynamic tag when a button has a href it will be a <a>,
when you add a for on the button the button will be a <label>.
If the button doesn't have a href or label it will be a <button>
Examples:

```
<x-rapidez::button href="something">Something</x-rapidez::button>
```

```
<x-rapidez::button for="something">Something</x-rapidez::button>
```

```
<x-rapidez::button>Something</x-rapidez::button>
```
--}}
@props(['tag' => 'button'])

@php
$tag = $attributes->hasAny('href', ':href', 'v-bind:href', 'x-bind:href') ? 'a' : $tag;
$tag = $attributes->has('for') ? 'label' : $tag;
@endphp

<x-tag is="{{ $tag }}" {{ $attributes }}>
{{ $slot }}
</x-tag>
12 changes: 12 additions & 0 deletions resources/views/components/button/enhanced.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{--
The enhanced button is a variant specifically used for anything conversion related.
Like purchasing a product or completing the checkout.
Example:

Roene-JustBetter marked this conversation as resolved.
Show resolved Hide resolved
```
<x-rapidez::button.enhanced>Something</x-rapidez::button.enhanced>
```
--}}
<x-rapidez::button {{ $attributes->twMerge('bg-enhanced text-white border-b border-black/15') }}>
{{ $slot }}
</x-rapidez::button>
11 changes: 11 additions & 0 deletions resources/views/components/button/index.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{--
This is the default button if you use the example you get this.
Example:

```
<x-rapidez::button>Something</x-rapidez::button>
```
--}}
<x-rapidez::button.base {{ $attributes->twMerge('relative inline-flex items-center justify-center transition text-white bg-neutral text-base font-medium rounded min-h-12 py-1.5 px-5 hover:bg-opacity-80 border-b border-black/15 disabled:text-inactive disabled:bg-disabled disabled:cursor-not-allowed') }}>
Roene-JustBetter marked this conversation as resolved.
Show resolved Hide resolved
Roene-JustBetter marked this conversation as resolved.
Show resolved Hide resolved
{{ $slot }}
</x-rapidez::button.base>
11 changes: 11 additions & 0 deletions resources/views/components/button/outline.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{--
This is an outline button so it doesn't need a background and only need a border.
Example:

```
<x-rapidez::button.outline>Something</x-rapidez::button.outline>
```
--}}
<x-rapidez::button {{ $attributes->twMerge('bg-transparent border text-neutral hover:border-neutral') }}>
{{ $slot }}
</x-rapidez::button>
11 changes: 11 additions & 0 deletions resources/views/components/button/primary.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{--
This is the primary button.
Example:

```
<x-rapidez::button.primary>Something</x-rapidez::button.primary>
```
--}}
<x-rapidez::button {{ $attributes->twMerge('bg-primary text-primary-text') }}>
{{ $slot }}
</x-rapidez::button>
11 changes: 11 additions & 0 deletions resources/views/components/button/secondary.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{--
This is the secondary button.
Example:

```
<x-rapidez::button.secondary>Something</x-rapidez::button.secondary>
```
--}}
<x-rapidez::button {{ $attributes->twMerge('bg-secondary text-secondary-text') }}>
{{ $slot }}
</x-rapidez::button>
11 changes: 11 additions & 0 deletions resources/views/components/button/slider.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{--
This button is used for sliders.
Example:

```
<x-rapidez::button.slider>Icon</x-rapidez::button.slider>
```
--}}
<x-rapidez::button {{ $attributes->twMerge('inline-flex bg-white p-0 rounded-full size-14 items-center justify-center shadow text-neutral border') }}>
{{ $slot }}
</x-rapidez::button>
1 change: 0 additions & 1 deletion resources/views/components/input/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@
</label>
```
--}}

<input {{ $attributes->twMerge('w-full py-3 px-5 border rounded-md border-border outline-0 ring-0 text-sm transition-colors focus:ring-transparent focus:border-neutral disabled:cursor-not-allowed disabled:bg-disabled disabled:border-disabled placeholder:text-inactive [&::-webkit-inner-spin-button]:appearance-none [&:user-invalid:not(:placeholder-shown)]:border-red-500') }} />
1 change: 0 additions & 1 deletion resources/views/components/input/radio/base.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
<x-rapidez::input.radio.base />
```
--}}

<input type="radio" {{ $attributes->twMerge('cursor-pointer border size-5 text-neutral border-border focus:outline-none focus:ring-0 focus:ring-offset-0') }} />
5 changes: 5 additions & 0 deletions resources/views/components/tag.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@props(['is' => 'div'])

<{{ $is }} {{ $attributes }}>
{{ $slot }}
</{{ $is }}>