Skip to content

Commit 1d9779e

Browse files
Merge pull request #3 from michaeldyrynda/pr-1
Add auth scaffolding and documentation
2 parents efeff88 + c03bfd1 commit 1d9779e

File tree

9 files changed

+264
-33
lines changed

9 files changed

+264
-33
lines changed

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
11
# Tachyons preset for the Laravel framework
2+
3+
### Installing
4+
```bash
5+
$ npm install
6+
```
7+
8+
### Setting up the new preset
9+
```bash
10+
$ php artisan preset tachyons
11+
```
12+
13+
### Auth scaffolding
14+
```bash
15+
$ php artisan preset tachyons-auth
16+
```
17+
18+
### Compiling assets
19+
```bash
20+
$ npm run dev
21+
```
22+
23+
Enjoy!

src/TachyonsPreset.php

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public static function install()
1313
{
1414
static::updatePackages();
1515
static::updateSass();
16+
static::updateBootstrapping();
1617
static::updateWelcomePage();
1718
static::removeNodeModules();
1819
}
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
@extends('layouts.app')
2+
3+
@section('content')
4+
5+
<div class="pa4-l">
6+
<form class="bg-near-white mw6 center pa4 br2-ns ba b--black-10" method="POST" action="{{ route('login') }}">
7+
{{ csrf_field() }}
8+
<fieldset class="cf bn ma0 pa0">
9+
<legend class="pa0 f4-ns mb3 black-80">Login</legend>
10+
<div class="cf">
11+
<label class="clip" for="email">Email Address</label>
12+
<input
13+
class="f6 f5-l input-reset black-80 bg-white pa3 lh-solid w-100 br2-ns @if ($errors->has('email')) ba b--light-red @else bn @endif"
14+
placeholder="Your Email Address"
15+
type="text"
16+
name="email"
17+
value="{{ old('email') }}"
18+
id="email">
19+
@if ($errors->has('email'))
20+
<p class="light-red f5 mt1">{{ $errors->first('email') }}</p>
21+
@endif
22+
23+
<input
24+
class="f6 f5-l input-reset black-80 bg-white pa3 lh-solid w-100 mt3 br2-ns @if ($errors->has('password'))ba b--light-red @else bn @endif"
25+
type="password"
26+
name="password"
27+
value=""
28+
id="password"
29+
placeholder="Password">
30+
@if ($errors->has('password'))
31+
<p class="light-red f5 mt1">{{ $errors->first('password') }}</p>
32+
@endif
33+
34+
<label class="f6 f5-l w-100 dt mb3 mt3">
35+
<input type="checkbox" name="remember" {{ old('remember') ? 'checked' : '' }}> Remember Me
36+
</label>
37+
<a
38+
href="{{ route('password.request') }}"
39+
class="link w-100 f6 f5-l dt gray mt3 mb3">Forgot your password?</a>
40+
<input
41+
class="f6 f5-l button-reset pv3 fr tc bn bg-animate bg-black-70 hover-bg-black white pointer w-100 w-25-m w-20-l br2-ns"
42+
type="submit"
43+
value="Login">
44+
</div>
45+
</fieldset>
46+
</form>
47+
</div>
48+
@endsection
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
@extends('layouts.app')
2+
3+
@section('content')
4+
<div class="pa4-l">
5+
@if (session('status'))
6+
<div class="mw6 center mb3 flex items-center justify-center pa4 bg-light-green navy">
7+
<svg class="w1" data-icon="info" viewBox="0 0 32 32" style="fill:currentcolor">
8+
<title>info icon</title>
9+
<path d="M16 0 A16 16 0 0 1 16 32 A16 16 0 0 1 16 0 M19 15 L13 15 L13 26 L19 26 z M16 6 A3 3 0 0 0 16 12 A3 3 0 0 0 16 6"></path>
10+
</svg>
11+
<span class="lh-title ml3">{{ session('status') }}</span>
12+
</div>
13+
@endif
14+
15+
<form class="bg-near-white mw6 center pa4 br2-ns ba b--black-10" method="POST" action="{{ route('password.email') }}">
16+
{{ csrf_field() }}
17+
<fieldset class="cf bn ma0 pa0">
18+
<legend class="pa0 f4-ns mb3 black-80">Reset Password</legend>
19+
<div class="cf">
20+
<label class="clip" for="email">E-Mail Address</label>
21+
<input
22+
class="f6 f5-l input-reset black-80 bg-white pa3 lh-solid w-100 br2-ns @if ($errors->has('email')) ba b--light-red @else bn @endif"
23+
placeholder="Your Email Address"
24+
type="text"
25+
name="email"
26+
value="{{ old('email') }}"
27+
id="email">
28+
@if ($errors->has('email'))
29+
<p class="light-red f5 mt1">{{ $errors->first('email') }}</p>
30+
@endif
31+
32+
<input
33+
class="f6 f5-l button-reset pv3 fr tc bn bg-animate bg-black-70 hover-bg-black white pointer w-100 w-100-m w-50-l br2-ns mt3"
34+
type="submit"
35+
value="Send Password Reset Link">
36+
</div>
37+
</fieldset>
38+
</form>
39+
</div>
40+
@endsection
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
@extends('layouts.app')
2+
3+
@section('content')
4+
5+
<div class="pa4-l">
6+
<form class="bg-near-white mw6 center pa4 br2-ns ba b--black-10" method="POST" action="{{ route('password.request') }}">
7+
{{ csrf_field() }}
8+
<input type="hidden" name="token" value="{{ $token }}">
9+
<fieldset class="cf bn ma0 pa0">
10+
<legend class="pa0 f4-ns mb3 black-80">Register</legend>
11+
<div class="cf">
12+
<label class="clip" for="email">Email Address</label>
13+
<input
14+
class="f6 mt3 f5-l input-reset black-80 bg-white pa3 lh-solid w-100 br2-ns @if ($errors->has('email')) ba b--light-red @else bn @endif"
15+
placeholder="Your Email Address"
16+
type="text"
17+
name="email"
18+
value="{{ old('email') }}"
19+
id="email">
20+
@if ($errors->has('email'))
21+
<p class="light-red f5 mt1">{{ $errors->first('email') }}</p>
22+
@endif
23+
24+
<input
25+
class="f6 f5-l input-reset black-80 bg-white pa3 lh-solid w-100 mt3 br2-ns @if ($errors->has('password'))ba b--light-red @else bn @endif"
26+
type="password"
27+
name="password"
28+
value=""
29+
id="password"
30+
placeholder="Password">
31+
@if ($errors->has('password'))
32+
<p class="light-red f5 mt1">{{ $errors->first('password') }}</p>
33+
@endif
34+
35+
<input
36+
class="f6 f5-l input-reset black-80 bg-white pa3 lh-solid w-100 mt3 br2-ns @if ($errors->has('password_confirmation')) ba b--light-red @else bn @endif"
37+
type="password"
38+
name="password_confirmation"
39+
value=""
40+
id="password_confirmation"
41+
placeholder="Confirm Password">
42+
@if ($errors->has('password_confirmation'))
43+
<p class="light-red f5 mt1">{{ $errors->first('password_confirmation') }}</p>
44+
@endif
45+
46+
<input
47+
class="f6 f5-l button-reset pv3 fr tc bn bg-animate bg-black-70 hover-bg-black white pointer w-100 w-25-m w-20-l br2-ns mt3"
48+
type="submit"
49+
value="Register">
50+
</div>
51+
</fieldset>
52+
</form>
53+
</div>
54+
@endsection
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
@extends('layouts.app')
2+
3+
@section('content')
4+
5+
<div class="pa4-l">
6+
<form class="bg-near-white mw6 center pa4 br2-ns ba b--black-10" method="POST" action="{{ route('register') }}">
7+
{{ csrf_field() }}
8+
<fieldset class="cf bn ma0 pa0">
9+
<legend class="pa0 f4-ns mb3 black-80">Register</legend>
10+
<div class="cf">
11+
<label class="clip" for="name">Name</label>
12+
<input
13+
class="f6 f5-l input-reset black-80 bg-white pa3 lh-solid w-100 br2-ns @if ($errors->has('name')) ba b--light-red @else bn @endif"
14+
placeholder="Name"
15+
type="text"
16+
name="name"
17+
value="{{ old('name') }}"
18+
id="name">
19+
@if ($errors->has('name'))
20+
<p class="light-red f5 mt1">{{ $errors->first('name') }}</p>
21+
@endif
22+
23+
<label class="clip" for="email">Email Address</label>
24+
<input
25+
class="f6 mt3 f5-l input-reset black-80 bg-white pa3 lh-solid w-100 br2-ns @if ($errors->has('email')) ba b--light-red @else bn @endif"
26+
placeholder="Your Email Address"
27+
type="text"
28+
name="email"
29+
value="{{ old('email') }}"
30+
id="email">
31+
@if ($errors->has('email'))
32+
<p class="light-red f5 mt1">{{ $errors->first('email') }}</p>
33+
@endif
34+
35+
<input
36+
class="f6 f5-l input-reset black-80 bg-white pa3 lh-solid w-100 mt3 br2-ns @if ($errors->has('password'))ba b--light-red @else bn @endif"
37+
type="password"
38+
name="password"
39+
value=""
40+
id="password"
41+
placeholder="Password">
42+
@if ($errors->has('password'))
43+
<p class="light-red f5 mt1">{{ $errors->first('password') }}</p>
44+
@endif
45+
46+
<input
47+
class="f6 f5-l input-reset black-80 bg-white pa3 lh-solid w-100 mt3 br2-ns @if ($errors->has('password_confirmation')) ba b--light-red @else bn @endif"
48+
type="password"
49+
name="password_confirmation"
50+
value=""
51+
id="password_confirmation"
52+
placeholder="Confirm Password">
53+
@if ($errors->has('password_confirmation'))
54+
<p class="light-red f5 mt1">{{ $errors->first('password_confirmation') }}</p>
55+
@endif
56+
57+
<input
58+
class="f6 f5-l button-reset pv3 fr tc bn bg-animate bg-black-70 hover-bg-black white pointer w-100 w-25-m w-20-l br2-ns mt3"
59+
type="submit"
60+
value="Register">
61+
</div>
62+
</fieldset>
63+
</form>
64+
</div>
65+
@endsection
+17-15
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
@extends('layouts.app')
22

33
@section('content')
4-
<section class="mw5 mw7-ns center pa3 ph5-ns">
5-
<article class="center mw5 mw6-ns br3 hidden ba b--black-10 mv4">
6-
<h1 class="f4 bg-near-white br3 br--top black-60 mv0 pv2 ph3">Dashboard</h1>
7-
<div class="pa3 bt b--black-10">
8-
@if (session('status'))
9-
<div class="flex pa4 bg-lightest-green green">
10-
<span class="lh-title ml3">
11-
{{ session('status') }}
12-
</span>
13-
</div>
14-
@endif
15-
16-
You are logged in!
4+
@if (session('status'))
5+
<div class="mw6 center mb3 flex items-center justify-center pa4 bg-light-green navy">
6+
<svg class="w1" data-icon="info" viewBox="0 0 32 32" style="fill:currentcolor">
7+
<title>info icon</title>
8+
<path d="M16 0 A16 16 0 0 1 16 32 A16 16 0 0 1 16 0 M19 15 L13 15 L13 26 L19 26 z M16 6 A3 3 0 0 0 16 12 A3 3 0 0 0 16 6"></path>
9+
</svg>
10+
<span class="lh-title ml3">{{ session('status') }}</span>
1711
</div>
18-
</article>
19-
</section>
12+
@endif
13+
<div class="mw5 center bg-white br3 pa3 pa4-ns mv3 ba b--black-10">
14+
<div class="tc">
15+
<h1 class="f4">Dashboard</h1>
16+
<hr class="mw3 bb bw1 b--black-10">
17+
</div>
18+
<p class="lh-copy measure dt center f5 black-70">
19+
You are logged in!
20+
</p>
21+
</div>
2022
@endsection

src/tachyons-stubs/views/layouts/app.blade.php

+17-18
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,25 @@
1515
</head>
1616
<body>
1717
<div id="app">
18-
<nav class="pa3 pa4-ns">
19-
<a class="link dim black b f6 f5-ns dib mr3" href="{{ url('/') }}">
20-
{{ config('app.name', 'Laravel') }}
18+
<nav class="db dt-l w-100 border-box pa3 ph5-l bg-almost bg-light-gray">
19+
<a class="db dtc-l v-mid mid-gray link dim w-100 w-25-l tc tl-l mb2 mb0-l tracked ttu" href="#" title="Home">
20+
{{ config('app.name') }}
2121
</a>
22-
@guest
23-
<a class="link dim gray f6 f5-ns dib mr3" href="{{ route('login') }}" title="Login">Login</a>
24-
<a class="link dim gray f6 f5-ns dib mr3" href="{{ route('register') }}" title="Register">Register</a>
25-
@else
26-
<a class="link dim black b f6 f5-ns dib mr3" href="#">
27-
{{ Auth::user()->name }}
28-
</a>
29-
<a class="link dim gray f6 f5-ns dib mr3"
30-
href="{{ route('logout') }}"
31-
onclick="event.preventDefault(); document.getElementById('logout-form').submit();"
32-
>
33-
Logout
34-
</a>
35-
@endguest
22+
<div class="db dtc-l v-mid w-100 w-75-l tc tr-l">
23+
@guest
24+
<a class="link dim dark-gray f6 f5-l dib mr3 mr4-l tracked" href="{{ url('/login') }}">Login</a>
25+
<a class="link dim dark-gray f6 f5-l dib tracked" href="{{ url('/register') }}">Register</a>
26+
@else
27+
<a href="{{ route('logout') }}"
28+
class="link dim dark-gray f6 f5-l dib mr3 mr4-l tracked"
29+
onclick="event.preventDefault();
30+
document.getElementById('logout-form').submit();">Logout</a>
31+
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
32+
{{ csrf_field() }}
33+
</form>
34+
@endguest
35+
</div>
3636
</nav>
37-
3837
@yield('content')
3938
</div>
4039

0 commit comments

Comments
 (0)