From e3f150b32cdd00ed35579b1bde6f3594eea2129b Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Tue, 7 Jan 2025 07:53:32 -0500 Subject: [PATCH] feat: More view changes. --- Public/css/main.css | 68 ++++++++++++++++++++++++++++++++++ Resources/Views/index.leaf | 4 +- Resources/Views/logged-in.leaf | 24 ++++++++---- Resources/Views/login.leaf | 26 ++++++++----- Sources/App/routes.swift | 18 ++++++++- 5 files changed, 122 insertions(+), 18 deletions(-) diff --git a/Public/css/main.css b/Public/css/main.css index bc25d42..144b7d0 100644 --- a/Public/css/main.css +++ b/Public/css/main.css @@ -1,4 +1,72 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + body { background-color: #1e1e2e; color: #ff66ff; } + +.container { + margin: 0 auto; + padding: 0 20px; + overflow: hidden; +} + +header { + background-color: #14141f; + color: #ff66ff; + padding: 10px 0; + border-bottom: 1px solid grey; +} + +#logo { + float: left; + font-size: 1.5em; +} + +nav { + float: right; +} + +.nav-links { + list-style-type: none; + margin: 0; + padding: 0; +} + +.nav-links li { + display: inline-block; + margin-left: 20px; +} + +.nav-links li a { + color: #fff; + text-decoration: none; + padding: 10px 15px; + display: inline-block; + transition: background-color 0.3s; +} + +.nav-links li a:hover { + background-color: #555; +} + +.content { + padding: 50px 0; +} + +.login-form { + padding: 50px 0; + text-align: center; +} + +.login-form label { + padding: 15px; +} + +.login-form input { + margin-bottom: 15px; +} diff --git a/Resources/Views/index.leaf b/Resources/Views/index.leaf index a15d9dd..57ebdc5 100644 --- a/Resources/Views/index.leaf +++ b/Resources/Views/index.leaf @@ -2,16 +2,18 @@ + #(title) -

#(title)

+
diff --git a/Resources/Views/logged-in.leaf b/Resources/Views/logged-in.leaf index 0118492..92a3e94 100644 --- a/Resources/Views/logged-in.leaf +++ b/Resources/Views/logged-in.leaf @@ -1,7 +1,17 @@ -

We're in!

- +
+
+
+ + +
+
+
+
+

We're in!

+
+
+
diff --git a/Resources/Views/login.leaf b/Resources/Views/login.leaf index 54a6b62..40103af 100644 --- a/Resources/Views/login.leaf +++ b/Resources/Views/login.leaf @@ -1,9 +1,17 @@ -
- - -
- - -
- -
+
+
+
+ +
+
+ + +
diff --git a/Sources/App/routes.swift b/Sources/App/routes.swift index 26db2b9..48146e1 100644 --- a/Sources/App/routes.swift +++ b/Sources/App/routes.swift @@ -7,7 +7,10 @@ func routes(_ app: Application) throws { let credentialsProtected = app.grouped(User.credentialsAuthenticator(), redirectMiddleware) app.get { req async throws in - try await req.view.render("index", ["title": "HHE - Purchase Orders"]) + try await req.view.render( + "index", + Index(showNavLinks: false) + ) } app.get("login") { req async throws -> View in @@ -59,6 +62,19 @@ func routes(_ app: Application) throws { try app.register(collection: ApiController()) } +struct Index: Content { + let title: String + let showNavLinks: Bool + + init( + title: String = "HHE - Purchase Orders", + showNavLinks: Bool + ) { + self.title = title + self.showNavLinks = showNavLinks + } +} + struct UserForm: Content { let username: String let password: String