You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-18Lines changed: 29 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Accessible Astro Dashboard
2
2
3
-
This Dashboard Theme is build upon the (awesome) [Astro Static Site Builder](https://astro.build/). This theme offers a couple of Accessibility componentsand some utility classes to get you building your project faster. Also check out the [Accessible Astro Components](https://github.com/markteekman/accessible-astro-components) npm package which can be used with (or without) this starter or the [Accessible Astro Starter](https://github.com/markteekman/accessible-astro-starter) theme, which comes with a blog and other accessibility features!
3
+
This Dashboard theme is build upon the (awesome) [Astro Static Site Builder](https://astro.build/). This theme offers a couple of Accessibility components, a couple of example pages, some admin pages, a custom 404 page and some utility classes to get you building your project faster. Also check out the [Accessible Astro Components](https://github.com/markteekman/accessible-astro-components) npm package which can be used with (or without) this starter!
In this Dashboard Theme you'll find a couple of things:
16
-
17
-
- Utilizes Astro's experimental SSR feature to redirect users to `/login` is there not logged in
18
-
- Uses `localStorage` to set a value of `isLoggedIn` to true when you log in using the login form
19
-
- Contains a `login.astro` page with an example login using a separate `LoginLayout.astro` layout
20
-
-`login.astro` contains example login data and a warning notification when the credentials are incorrect
15
+
- Contains a `login.astro` page with an example login using the `localStorage` and a separate `LoginLayout.astro` layout
16
+
-`login.astro` contains example login data and a warning notification for when the credentials are incorrect
21
17
- Contains a dashboard example in the `index.astro` page using the `DefaultLayout.astro` layout
22
18
- Several examples of admin pages such as `media.astro`, `messages.astro`, `products.astro`, `settings.astro` and `users.astro`
23
19
-`Button.astro` component with simple, accessible styling and a property for `type="submit"`
24
20
-`LoginForm.astro` component with a basic accessible login form and some form controls
25
21
-`SkipLinks.astro` component to skip to either the main menu or the main content
26
-
-`Navigation.astro` component with keyboard accessible (dropdown) navigation (arrow keys, escape key), which is expandable on desktop
22
+
-`Navigation.astro` component with keyboard accessible navigation (arrow keys, escape key)
27
23
- This component is a comprehensive sidebar navigation on desktop with the option to expand or collapse
28
24
- The users menu width preference is stored in a `localStorage` value so that it is preserved during page reloads
29
25
- The navigation automatically switches to an accessible mobile navigation for viewport widths below the medium breakpoint
30
-
-`ResponsiveToggle.astro` component with an accessible responsive toggle button for the navigation
26
+
-`ResponsiveToggle.astro` component with an accessible responsive toggle button for the mobile navigation
31
27
-`DarkMode.astro` component toggle with accessible button which saves the users preference in the `localStorage`
28
+
-`DashboardWidget.astro` component serves as an example for the dashboard on `index.astro`
32
29
-`EmpyState.astro` component which can be displayed on pages that don't have any data yet
33
30
-`404.astro` provides a custom 404 error page which you can adjust to your needs
34
31
-`.sr-only` utility class for screen reader only text content
@@ -39,16 +36,22 @@ In this Dashboard Theme you'll find a couple of things:
39
36
40
37
## Login & Authentication
41
38
42
-
This theme contains an example login flow, using a fake email address and password and by utilizing the `localStorage` and Astro's (experimental) SSR feature. All pages redirect to `/login.astro` if you haven't logged in using `Astro.redirect`. After logging in the value `isLoggedIn` is set to `true`and your authenticated to view the admin pages.
39
+
This starter contains a basic example of authentication and redirecting based on a users logged in status. However, this is done using SSG, which is not ideal, but serves the purpose of this demo. For better authentication and redirecting you should use Astro's (experimental) SSR.
43
40
44
-
⚠️ **Note: this is just an example, make sure you build your own secure authentication. Checkout this [official Astro Blog post](https://astro.build/blog/experimental-server-side-rendering/) for more information about authentication and login.**
41
+
### Enabling SSR
42
+
43
+
For the purpose of the demo I have not enabled SSR, simply due to the fact how I've setup the demo websites of all [accessible-astro.dev](https://accessible-astro.dev) subdomains. However, I might add it in the future. It is the preferred way to handle your login and redirect cases.
45
44
46
45
### LoginForm.astro
47
46
47
+
This theme contains an example login flow, using a fake email address and password and by utilizing the `localStorage`. All pages redirect to `/login.astro` if you haven't logged in. After logging in the value `isLoggedIn` is set to `true` and your authenticated to view the admin pages. When building this using SSR you should use `cookies` instead of the `localStorage`.
48
+
49
+
⚠️ **Note: this is just an example, make sure you build your own secure authentication. Checkout this [official Astro Blog post](https://astro.build/blog/experimental-server-side-rendering/) for more information about authentication and login.**
50
+
48
51
```js
49
52
<script>
50
53
// fetch your data from an API
51
-
// and replace that an actual user object for example
54
+
// and replace that with an actual user object for example
If you find that something isn't working right then I'm always happy to hear it to improve this starter! You can contribute in many ways and forms. Let me know by either:
239
250
240
-
1.[Filing an issue](https://github.com/markteekman/accessible-astro-starter/issues)
241
-
2.[Submitting a pull request](https://github.com/markteekman/accessible-astro-starter/pulls)
242
-
3.[Starting a discussion](https://github.com/markteekman/accessible-astro-starter/discussions)
243
-
4.[Buying me a coffee!](https://www.buymeacoffee.com/markteekman) Help keep the demo's and docs up and running 😊
251
+
1.[Filing an issue](https://github.com/markteekman/accessible-astro-dashboard/issues)
252
+
2.[Submitting a pull request](https://github.com/markteekman/accessible-astro-dashboard/pulls)
253
+
3.[Starting a discussion](https://github.com/markteekman/accessible-astro-dashboard/discussions)
254
+
4.[Buying me a coffee!](https://www.buymeacoffee.com/markteekman)
0 commit comments