Skip to content

Commit 6bb85a0

Browse files
committed
Adding latest updates to the auth page
1 parent c1118ad commit 6bb85a0

11 files changed

+131
-186
lines changed

content/docs/config/email.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
---
22
title: Email Template
33
description: Learn how to edit the email template to add your own logo and style
4-
slug: 'email'
54
nextTitle: 'Config Files'
6-
nextURL: '/config/files'
7-
nextSlug: 'config/files'
5+
nextURL: '/docs/config/files'
6+
nextSlug: 'files'
7+
slug: 'email'
88
prevTitle: 'Two-Factor Auth'
9-
prevURL: '/config/two-factor-auth'
9+
prevURL: '/docs/config/two-factor-auth'
10+
prevSlug: 'two-factor-auth'
1011
---
1112

1213
# Email Template Design

content/docs/config/files.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
---
22
title: Config Files
33
description: Learn about how DevDojo Auth uses configuration files to change and customize the authentication functionality
4+
prevTitle: 'Email Template'
5+
prevURL: '/docs/config/email'
6+
prevSlug: 'email'
7+
slug: 'files'
8+
nextTitle: 'Github Action'
9+
nextURL: '/docs/config/github-action'
10+
nextSlug: 'github-action'
411
---
512

613

content/docs/config/github-action.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
---
22
title: Github Action Workflow
33
description: DevDojo Auth ships with a Github action that can help gaurantee that your authentication is fully functional.
4+
nextTitle: 'Authentication Events'
5+
nextURL: '/docs/extend/events'
6+
nextSlug: 'events'
7+
slug: 'github-action'
8+
prevTitle: 'Config Files'
9+
prevURL: '/docs/config/files'
10+
prevSlug: 'files'
411
---
512

613

content/docs/config/social-providers.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
---
22
title: Social Providers
33
description: Allow users to authenticate with many Social Providers
4+
prevTitle: 'Setup & Customizations'
5+
prevURL: '/docs/setup-customizations'
6+
prevSlug: 'setup-customizations'
7+
slug: 'social-providers'
8+
nextTitle: 'Two Factor Auth'
9+
nextURL: '/docs/config/two-factor-auth'
10+
nextSlug: 'two-factor-auth'
411
---
512

613

content/docs/config/two-factor-auth.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
---
22
title: Two-Factor Authentication
33
description: Learn about Two-Factor Auth and how to enable it for your application.
4+
prevTitle: 'Social Providers'
5+
prevURL: '/docs/config/social-providers'
6+
prevSlug: 'social-providers'
7+
slug: 'two-factor-auth'
8+
nextTitle: 'Email Template'
9+
nextURL: '/docs/config/email'
10+
nextSlug: 'email'
11+
12+
413
---
514

615
# Using Two-Factor Authentication (2FA)

content/docs/contributing.md

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
---
2+
title: Contributing
3+
description: Want to make some contributions. Learn more here.
4+
prevTitle: 'Custom Components'
5+
prevURL: '/docs/extend/components'
6+
prevSlug: 'components'
7+
slug: 'troubleshooting'
8+
nextTitle: 'Troubleshooting'
9+
nextURL: '/docs/troubleshooting'
10+
nextSlug: 'troubleshooting'
11+
---
12+
13+
# Contributing
14+
115
We welcome all new contributions to this project. If you would like to contribute to this package it will probably be helpful to learn how to setup a local version for working on the DevDojo Auth package.
216

317
## Local Dev Version

content/docs/extend/components.md

+26-67
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,38 @@
11
---
22
title: Custom Components
33
description: Learn how to override the authentication page components to take full control of how your authentication pages feel and function.
4+
nextTitle: 'Contributing'
5+
nextURL: '/docs/contributing'
6+
nextSlug: 'contributing'
7+
slug: 'github-action'
8+
prevTitle: 'Authentication Events'
9+
prevURL: '/docs/extend/events'
10+
prevSlug: 'events'
411
---
512

613
# Custom Components
714

815
## Introduction
916

10-
The DevDojo Auth package allows you to customize its components by providing your own versions. This gives you the flexibility to tailor the authentication experience to fit your application's design and requirements. By adding your own Blade components, you can override the default components provided by the package.
17+
You can include additional customizations by adding your own Blade components, you can override the default components provided by the package.
1118

1219
## Creating Custom Components
1320

1421
### Step 1: Publish the Default Components
1522

16-
To start with the current components from the Auth package, you can publish them to your application's `resources/views/components/auth` directory.
23+
To start with the current components from the Auth package, you can publish them to your application's `resources/views/components/auth/elements` directory.
1724

1825
```bash
1926
php artisan vendor:publish --tag=auth:components
2027
```
2128

22-
This command will publish the default components to `resources/views/components/app/elements`.
29+
This command will publish the default components to `resources/views/components/app/elements`. Any components in this folder can be used as opposed to the default components. This gives you ultimate flexibility on how your authentication will look and feel.
2330

24-
### Step 2: Create the Custom Component
31+
Next, you need to specify which component you want to override.
2532

26-
Create a Blade file for your custom component in the `resources/views/components/app/elements` directory. For example, to customize the button component, create the following file:
33+
## Step 2: Override Component
2734

28-
```
29-
resources/views/components/app/elements/button.blade.php
30-
```
31-
32-
### Example Custom Button Component
33-
34-
```blade
35-
<button {{ $attributes->merge(['class' => 'custom-button-class']) }}>
36-
{{ $slot }}
37-
</button>
38-
```
39-
40-
### Step 3: Register the Custom Component
41-
42-
To make sure your custom components are used instead of the default ones, you need to register the custom components in your `AppServiceProvider`.
43-
44-
#### Example `AppServiceProvider`:
35+
To use your custom component instead of the default one, you need to register it in your `AppServiceProvider`.
4536

4637
```php
4738
namespace App\Providers;
@@ -58,62 +49,30 @@ class AppServiceProvider extends ServiceProvider
5849

5950
public function boot()
6051
{
61-
Blade::component('components.app.elements.button', 'auth::elements.button');
52+
Blade::component('components.auth.elements.button', 'auth::elements.button');
6253
// Add more components as needed
6354
}
6455
}
6556
```
6657

67-
### Step 4: Use the Custom Component
68-
69-
In your Blade views, use the custom component as follows:
70-
71-
```blade
72-
<x-auth::elements.button>
73-
Click Me
74-
</x-auth::elements.button>
75-
```
58+
For instance, the above code will now use the `button` component from your local `resources/views/components/auth/elements` folder.
7659

77-
This will render the custom button component you created.
60+
### Step 3: Customize the component
7861

79-
## Additional Information
62+
You can now customize the Blade component as much as you would like. We are utilizing <a href="https://tailwindcss.com" target="_blank">Tailwind CSS</a> and <a href="https://alpinejs.dev" target="_blank">AlpineJS</a> within these components, so that is how you can customize styles or functionality.
8063

81-
### Customizing Other Components
64+
## Step 4: Update the Assets
8265

83-
You can follow the same process to customize other components provided by the DevDojo Auth package. Simply publish the components, create your custom versions, and register them in your `AppServiceProvider`.
66+
You may have added some additional Tailwind classes in your custom component that are not included by the default components. To do this, you can run the following command:
8467

85-
### Example: Custom Input Component
86-
87-
1. **Publish the default input component:**
88-
89-
```bash
90-
php artisan vendor:publish --tag=auth:components
91-
```
92-
93-
2. **Create a custom input component:**
94-
95-
```
96-
resources/views/components/app/elements/input.blade.php
97-
```
98-
99-
3. **Example custom input component:**
100-
101-
```blade
102-
<input {{ $attributes->merge(['class' => 'custom-input-class']) }}>
103-
```
104-
105-
4. **Register the custom input component in `AppServiceProvider`:**
106-
107-
```php
108-
Blade::component('components.app.elements.input', 'auth::elements.input');
109-
```
68+
```bash
69+
npx tailwindcss -c ./packages/devdojo/auth/tailwind.config.js -o ./public/auth/build/assets/styles.css
70+
```
11071

111-
5. **Use the custom input component:**
72+
You will now see your updated styles within your authentication pages.
11273

113-
```blade
114-
<x-auth::elements.input type="text" name="username">
115-
```
74+
> Tip: if you are trying to override styles that are set by Auth itself, for instance the background color, you may have to use !important (ex: !bg-pink-500), although the best process for this would be just to use the `button color` settings in the authentication setup pages.
11675
117-
## Conclusion
76+
## Testing
11877

119-
By following these steps, you can easily customize the components of the DevDojo Auth package to fit your application's needs. This flexibility allows you to maintain a consistent design and user experience across your application.
78+
It's probably best to have your CI setup to run through the authentication functionality whenever you make a new PR. This way if you broke something when adding your own custom component, you will be aware.

0 commit comments

Comments
 (0)