Skip to content

Commit

Permalink
chore: resolve components path
Browse files Browse the repository at this point in the history
  • Loading branch information
dammy001 committed Nov 18, 2023
1 parent f0e2daf commit 5b136b2
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 66 deletions.
120 changes: 60 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ composer require damilaredev/laravel-email
Add the component to your email template. Include styles where needed.

```html
<x-laravel-email.html>
<x-laravel-email.head>
<x-laravel-email-html>
<x-laravel-email-head>
<link rel="dns-prefetch" href="//fonts.gstatic.com">

<x-laravel-email.font
<x-laravel-email-font
:font-family="'Br Firma'"
:web-font="[
'url' => 'https://fonts.gstatic.com/s/opensans/v18/mem8YaGs126MiZpBA-UFVZ0e.ttf',
Expand All @@ -38,20 +38,20 @@ Add the component to your email template. Include styles where needed.
:font-style="'normal'"
:font-weight="400"
/>
</x-laravel-email.head>
</x-laravel-email-head>

<x-laravel-email.body
<x-laravel-email-body
style="margin-left:auto;margin-right:auto;margin-top:auto;margin-bottom:auto;background-color:rgba(255, 255, 255, 1);font-family:Open Sans, ui-sans-serif, system-ui, -apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,Ubuntu,sans-serif"
>
<x-laravel-email.container style="margin-left:auto;margin-right:auto; max-width:50em;margin:10px auto;">
<x-laravel-email.section>
<x-laravel-email.heading style="font-size:1.75rem;line-height:43.99px;font-weight:700;text-align:left; color: rgba(80, 85, 94, 1);">
<x-laravel-email-container style="margin-left:auto;margin-right:auto; max-width:50em;margin:10px auto;">
<x-laravel-email-section>
<x-laravel-email-heading style="font-size:1.75rem;line-height:43.99px;font-weight:700;text-align:left; color: rgba(80, 85, 94, 1);">
Laravel Email
</x-laravel-email.heading>
</x-laravel-email.section>
</x-laravel-email.container>
</x-laravel-email.body>
</x-laravel-email.html>
</x-laravel-email-heading>
</x-laravel-email-section>
</x-laravel-email-container>
</x-laravel-email-body>
</x-laravel-email-html>
```

## Components
Expand All @@ -60,35 +60,35 @@ A set of standard components to help you build amazing emails without having to

### HTML
```html
<x-laravel-email.html lang="en" dir="ltr">
<x-laravel-email.link href="https://example.com">
<x-laravel-email-html lang="en" dir="ltr">
<x-laravel-email-link href="https://example.com">
Click Me
</x-laravel-email.link>
</x-laravel-email.html>
</x-laravel-email-link>
</x-laravel-email-html>
```

### Head
```html
<x-laravel-email.head>
<x-laravel-email-head>
<title>email title</title>
</x-laravel-email.head>
</x-laravel-email-head>
```

### Heading
```html
<x-laravel-email.heading as="h1">Lorem Ipsum</x-laravel-email.heading>
<x-laravel-email-heading as="h1">Lorem Ipsum</x-laravel-email-heading>
```

### Link
```html
<x-laravel-email.link href="https://example.com">
<x-laravel-email-link href="https://example.com">
Example
</x-laravel-email.link>
</x-laravel-email-link>
```

### Image
```html
<x-laravel-email.img
<x-laravel-email-img
src="dog.jpg"
alt="dog"
width="200"
Expand All @@ -107,74 +107,74 @@ A set of standard components to help you build amazing emails without having to

### Divider
```html
<x-laravel-email.hr />
<x-laravel-email-hr />
```

### Paragraph
```html
<x-laravel-email.text>Lorem Ipsum</x-laravel-email.text>
<x-laravel-email-text>Lorem Ipsum</x-laravel-email-text>
```

### Container
```html
<x-laravel-email.container>
<x-laravel-email.link href="https://example.com" style="font-weight: 500; color: #0000;">
<x-laravel-email-link href="https://example.com" style="font-weight: 500; color: #0000;">
Click here
</x-laravel-email.link>
</x-laravel-email-link>
</x-laravel-email.container>
```

### Body
```html
<x-laravel-email.html lang="en">
<x-laravel-email.body style="background-color: rgba(37, 60, 172, 1);">
<x-laravel-email.section>
<x-laravel-email.column style="width: 50%">
<x-laravel-email-html lang="en">
<x-laravel-email-body style="background-color: rgba(37, 60, 172, 1);">
<x-laravel-email-section>
<x-laravel-email-column style="width: 50%">
{{-- First column --}}
</x-laravel-email.column>
<x-laravel-email.column style="width: 50%">
</x-laravel-email-column>
<x-laravel-email-column style="width: 50%">
{{-- Second column --}}
</x-laravel-email.column>
</x-laravel-email.section>
</x-laravel-email.body>
</x-laravel-email.html>
</x-laravel-email-column>
</x-laravel-email-section>
</x-laravel-email-body>
</x-laravel-email-html>
```

### Row
```html
<x-laravel-email.row>
<x-laravel-email.column>A</x-laravel-email.column>
<x-laravel-email.column>B</x-laravel-email.column>
<x-laravel-email.column>C</x-laravel-email.column>
</x-laravel-email.row>
<x-laravel-email-row>
<x-laravel-email-column>A</x-laravel-email-column>
<x-laravel-email-column>B</x-laravel-email-column>
<x-laravel-email-column>C</x-laravel-email-column>
</x-laravel-email-row>
```

### Section
```html
{{-- A Simple Section --}}
<x-laravel-email.section>
<x-laravel-email.text>Lorem Ipsum</x-laravel-email.text>
</x-laravel-email.section>
<x-laravel-email-section>
<x-laravel-email-text>Lorem Ipsum</x-laravel-email-text>
</x-laravel-email-section>

{{-- Formatted with `rows` and `columns` --}}
<x-laravel-email.section>
<x-laravel-email.row>
<x-laravel-email.column>Column 1, Row 1</x-laravel-email.column>
<x-laravel-email.column>Column 2, Row 1</x-laravel-email.column>
</x-laravel-email.row>
<x-laravel-email-section>
<x-laravel-email-row>
<x-laravel-email-column>Column 1, Row 1</x-laravel-email-column>
<x-laravel-email-column>Column 2, Row 1</x-laravel-email-column>
</x-laravel-email-row>

<x-laravel-email.row>
<x-laravel-email.column>Column 1, Row 2</x-laravel-email.column>
<x-laravel-email.column>Column 2, Row 2</x-laravel-email.column>
</x-laravel-email.row>
</x-laravel-email.section>
<x-laravel-email-row>
<x-laravel-email-column>Column 1, Row 2</x-laravel-email-column>
<x-laravel-email-column>Column 2, Row 2</x-laravel-email-column>
</x-laravel-email-row>
</x-laravel-email-section>
```

### Font
```html
<x-laravel-email.html lang="en">
<x-laravel-email.head>
<x-laravel-email.font
<x-laravel-email-html lang="en">
<x-laravel-email-head>
<x-laravel-email-font
font-family="Br Firma"
fallback-font-family="Verdana"
:web-font="[
Expand All @@ -184,8 +184,8 @@ A set of standard components to help you build amazing emails without having to
font-style="normal"
font-weight="400"
/>
</x-laravel-email.head>
</x-laravel-email.html>
</x-laravel-email-head>
</x-laravel-email-html>
```

## Support
Expand Down
36 changes: 30 additions & 6 deletions src/LaravelEmailServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@

namespace Damilaredev\LaravelEmail;

use Illuminate\Support\Facades\Blade;
use Damilaredev\LaravelEmail\View\Components\Body;
use Damilaredev\LaravelEmail\View\Components\Column;
use Damilaredev\LaravelEmail\View\Components\Container;
use Damilaredev\LaravelEmail\View\Components\Font;
use Damilaredev\LaravelEmail\View\Components\Head;
use Damilaredev\LaravelEmail\View\Components\Heading;
use Damilaredev\LaravelEmail\View\Components\Hr;
use Damilaredev\LaravelEmail\View\Components\Html;
use Damilaredev\LaravelEmail\View\Components\Img;
use Damilaredev\LaravelEmail\View\Components\Link;
use Damilaredev\LaravelEmail\View\Components\Row;
use Damilaredev\LaravelEmail\View\Components\Section;
use Damilaredev\LaravelEmail\View\Components\Text;
use Illuminate\Support\ServiceProvider;

class LaravelEmailServiceProvider extends ServiceProvider
Expand Down Expand Up @@ -41,7 +53,8 @@ protected function bootPublishing(): static
{
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../resources/views' => $this->app->resourcePath('views/vendor/laravel-email'),
__DIR__.'/../src/View/Components/' => app_path('View/Components'),
__DIR__.'/../resources/views/components/' => resource_path('views/vendor/components/laravel-email'),
], 'laravel-email-views');
}

Expand All @@ -53,10 +66,21 @@ protected function bootPublishing(): static
*/
protected function bootComponents(): static
{
Blade::componentNamespace(
'Damilaredev\\LaravelEmail\\View\\Components',
'laravel-email'
);
$this->loadViewComponentsAs('laravel-email', [
Head::class,
Body::class,
Html::class,
Hr::class,
Row::class,
Column::class,
Section::class,
Text::class,
Img::class,
Font::class,
Link::class,
Heading::class,
Container::class,
]);

return $this;
}
Expand Down

0 comments on commit 5b136b2

Please sign in to comment.