Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Adds global styles from the Next.js example

Paul Copplestone38e684c22705
diff --git a/examples/nextjs-ts-user-managment/README.md b/examples/nextjs-ts-user-managment/README.md
index 03edf37b0bf..898bdbcb309 100644
--- a/examples/nextjs-ts-user-managment/README.md
+++ b/examples/nextjs-ts-user-managment/README.md
@@ -1,37 +1,4 @@
# Supabase Next.js User Management
-- Create a file `.env.local`
-- Add a `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_KEY`
-- Run `npm run dev`
+This is a WIP!
-## Database schema
-
-```sql
-create table profiles (
- id uuid references auth.users not null,
- updated_at timestamp with time zone,
- username text unique,
- avatar_url text,
- website text,
-
- primary key (id),
- unique(username),
- constraint username_length check (char_length(username) >= 3)
-);
-alter table profiles enable row level security;
-create policy "Public profiles are viewable by everyone." on profiles for select using (true);
-create policy "Users can insert their own profile." on profiles for insert with check (auth.uid() = id);
-create policy "Users can update own profile." on profiles for update using (auth.uid() = id);
-
--- Set up Realtime!
-begin;
- drop publication if exists supabase_realtime;
- create publication supabase_realtime;
-commit;
-alter publication supabase_realtime add table profiles;
-
--- Set up Storage!
-insert into storage.buckets (id, name) values ('avatars', 'avatars');
-create policy "Avatar images are publicly accessible." on storage.objects for select using ( bucket_id = 'avatars' );
-create policy "Anyone can upload an avatar." on storage.objects for insert using ( bucket_id = 'avatars' );
-```
diff --git a/examples/nuxtjs-user-management/README.md b/examples/nuxtjs-user-management/README.md
index 06656dce622..f4bdc9bbf65 100644
--- a/examples/nuxtjs-user-management/README.md
+++ b/examples/nuxtjs-user-management/README.md
@@ -1,20 +1,23 @@
-# nuxtjs-user-management
+# Supabase Nuxt.js User Management
+
+
+This is a WIP!
## Build Setup
```bash
# install dependencies
-$ npm install
+npm install
# serve with hot reload at localhost:3000
-$ npm run dev
+npm run dev
# build for production and launch server
-$ npm run build
-$ npm run start
+npm run build
+npm run start
# generate static project
-$ npm run generate
+npm run generate
```
For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org).
diff --git a/examples/nuxtjs-user-management/assets/global.css b/examples/nuxtjs-user-management/assets/global.css
new file mode 100644
index 00000000000..e5af8869660
--- /dev/null
+++ b/examples/nuxtjs-user-management/assets/global.css
@@ -0,0 +1,322 @@
+html,
+body {
+ --custom-font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu,
+ Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
+ --custom-bg-color: #101010;
+ --custom-box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.8);
+ --custom-color: #fff;
+ --custom-color-brand: #24b47e;
+ --custom-color-secondary: #666;
+ --custom-border: 1px solid #333;
+ --custom-border-radius: 5px;
+ --custom-spacing: 5px;
+
+ padding: 0;
+ margin: 0;
+ font-family: var(--custom-font-family);
+ background-color: var(--custom-bg-color);
+}
+
+* {
+ color: var(--custom-color);
+ font-family: var(--custom-font-family);
+ box-sizing: border-box;
+}
+
+/* Forms */
+
+label {
+ display: block;
+ margin: 5px 0;
+ color: var(--custom-color-secondary);
+ font-size: 0.8rem;
+ text-transform: uppercase;
+}
+
+input {
+ width: 100%;
+ border-radius: 5px;
+ border: var(--custom-border);
+ padding: 6px;
+ font-size: 0.9rem;
+ background-color: var(--custom-bg-color);
+ color: var(--custom-color);
+}
+
+input[disabled] {
+ color: var(--custom-color-secondary);
+}
+
+/* Utils */
+
+.w-half {
+ width: 50%;
+}
+.block {
+ display: block;
+ width: 100%;
+}
+.inline-block {
+ display: inline-block;
+ width: 100%;
+}
+.flex {
+ display: flex;
+}
+.flex.column {
+ flex-direction: column;
+}
+.flex.row {
+ flex-direction: row;
+}
+.flex.flex-1 {
+ flex: 1 1 0;
+}
+.flex-end {
+ justify-content: flex-end;
+}
+.flex-center {
+ justify-content: center;
+}
+.text-sm {
+ font-size: 0.8rem;
+ font-weight: 300;
+}
+
+/* Button */
+
+button,
+.button {
+ color: var(--custom-color);
+ border: var(--custom-border);
+ background-color: var(--custom-bg-color);
+ display: inline-block;
+ text-align: center;
+ border-radius: var(--custom-border-radius);
+ padding: 0.5rem 1rem;
+ cursor: pointer;
+ text-align: center;
+ font-size: 0.9rem;
+ text-transform: uppercase;
+}
+
+button.primary,
+.button.primary {
+ background-color: var(--custom-color-brand);
+ border: 1px solid var(--custom-color-brand);
+}
+
+/* Widgets */
+
+.card {
+ width: 100%;
+ display: block;
+ border: var(--custom-border);
+ border-radius: var(--custom-border-radius);
+ padding: var(--custom-spacing);
+}
+
+.avatar {
+ border-radius: var(--custom-border-radius);
+ overflow: hidden;
+ max-width: 100%;
+}
+.avatar.image {
+ object-fit: cover;
+}
+.avatar.noImage {
+ background-color: rgb(230, 230, 230);
+ border: 2px dotted rgb(200, 200, 200);
+ border-radius: 5px;
+}
+.avatar.noImage:after {
+ font-family: var(--custom-font-family);
+ content: 'No avatar photo';
+ display: block;
+ font-size: 16px;
+ color: rgb(100, 100, 100);
+
+ position: absolute;
+ top: 50%;
+ left: 0;
+ width: 100%;
+ -webkit-transform: translateY(-50%);
+ transform: translateY(-50%);
+ text-align: center;
+}
+
+.footer {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ display: flex;
+ flex-flow: row;
+ border-top: var(--custom-border);
+}
+.footer div {
+ padding: var(--custom-spacing);
+ display: flex;
+ align-items: center;
+ width: 100%;
+}
+.footer div > img {
+ height: 20px;
+ margin-left: 10px;
+}
+
+@keyframes spin {
+ from {
+ transform: rotate(0deg);
+ }
+ to {
+ transform: rotate(360deg);
+ }
+}
+
+.mainHeader {
+ width: 100%;
+ font-size: 1.3rem;
+ margin-bottom: 20px;
+}
+
+.avatarPlaceholder {
+ border: var(--custom-border);
+ border-radius: var(--custom-border-radius);
+ width: 40px;
+ height: 40px;
+ background-color: rgba(255, 255, 255, 0.2);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+/* Auth */
+
+.authContainer {
+ display: flex;
+ /* flex-direction: column; */
+ align-items: center;
+ justify-items: center;
+}
+
+.authContainer > .authTitle {
+ width: 22rem;
+ margin-right: 40px;
+}
+
+.authContainer > .authTitle > .header {
+ font-weight: 400;
+}
+
+.authContainer > .authTitle > .description {
+ opacity: 50%;
+ font-weight: 300;
+ line-height: 1.6em;
+}
+
+.authWidget {
+ background-color: #181818;
+ border: 1px solid #2a2a2a;
+ padding: 30px 30px;
+ border-radius: 5px;
+ width: 28rem;
+}
+
+.authWidget > .description {
+ margin: 0;
+ font-size: 0.9rem;
+}
+
+.authWidget > .inputField {
+ border: none;
+ padding: 10px 10px;
+}
+
+.authWidget > .button {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border: none;
+ background-color: #444444;
+ text-transform: none !important;
+ transition: all 0.2s ease;
+}
+
+.authWidget > .button:hover {
+ background-color: #2a2a2a;
+}
+
+.authWidget > .button > .loader {
+ width: 17px;
+ animation: spin 1s linear infinite;
+ filter: invert(1);
+}
+
+/* Account */
+
+.account {
+ width: 100%;
+ max-width: 400px;
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+}
+
+.account > * > .avatarField {
+ display: flex;
+ align-items: center;
+ margin-bottom: 30px;
+}
+
+.account > * > .avatarField > .avatarContainer {
+ margin-right: 20px;
+}
+
+/* Profile Card */
+
+.profileCard {
+ border-radius: 5px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ background-color: #2a2a2a;
+ padding: 30px;
+}
+
+.profileCard > .avatarContainer {
+ border-radius: 50%;
+ overflow: hidden;
+ margin-bottom: 30px;
+}
+
+.profileCard > .avatar {
+ border-top-right-radius: 0 !important;
+ border-bottom-right-radius: 0 !important;
+}
+
+.profileCard > .userInfo {
+ width: 100%;
+ font-weight: 300;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+}
+
+.profileCard > .userInfo > p {
+ margin: 0;
+}
+
+.profileCard > .userInfo > .username {
+ font-size: 1.3rem;
+ font-weight: 500;
+ margin-bottom: 10px;
+}
+
+.profileCard > .userInfo > .website {
+ font-size: 0.9rem;
+ margin-bottom: 10px;
+ color: var(--custom-color-brand);
+ text-decoration: none;
+}
diff --git a/examples/nuxtjs-user-management/components/Account.vue b/examples/nuxtjs-user-management/components/Account.vue
index 5a2eb92d661..3bc658c6c57 100644
--- a/examples/nuxtjs-user-management/components/Account.vue
+++ b/examples/nuxtjs-user-management/components/Account.vue
@@ -102,17 +102,3 @@ export default {
},
}
</script>
-
-<style scoped>
-.account-container {
- min-width: 250;
- max-width: 600;
- margin: auto;
- display: flex;
- flex-direction: column;
-}
-
-.account-container > div {
- margin: 10px;
-}
-</style>
\ No newline at end of file
diff --git a/examples/nuxtjs-user-management/components/Auth.vue b/examples/nuxtjs-user-management/components/Auth.vue
index 5dec0b1b697..6c4d0a776ab 100644
--- a/examples/nuxtjs-user-management/components/Auth.vue
+++ b/examples/nuxtjs-user-management/components/Auth.vue
@@ -55,10 +55,3 @@ export default {
},
};
</script>
-
-<style scoped>
-.auth-container {
- display: flex;
- flex-direction: column;
-}
-</style>
diff --git a/examples/nuxtjs-user-management/nuxt.config.js b/examples/nuxtjs-user-management/nuxt.config.js
index 12a08c86eb8..af21ceda2a2 100644
--- a/examples/nuxtjs-user-management/nuxt.config.js
+++ b/examples/nuxtjs-user-management/nuxt.config.js
@@ -3,7 +3,7 @@ export default {
// URL: process.env.SUPABASE_URL,
// KEY: process.env.SUPABASE_KEY
// },
-
+
// Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode
ssr: false,
@@ -11,39 +11,31 @@ export default {
head: {
title: 'nuxtjs-user-management',
htmlAttrs: {
- lang: 'en'
+ lang: 'en',
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
- { hid: 'description', name: 'description', content: '' }
+ { hid: 'description', name: 'description', content: '' },
],
- link: [
- { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
- ]
+ link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
},
// Global CSS: https://go.nuxtjs.dev/config-css
- css: [
- ],
+ css: ['@/assets/global.css'],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
- plugins: [
- ],
+ plugins: [],
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
- buildModules: [
- '@nuxtjs/dotenv'
- ],
+ buildModules: ['@nuxtjs/dotenv'],
// Modules: https://go.nuxtjs.dev/config-modules
- modules: [
- ],
+ modules: [],
// Build Configuration: https://go.nuxtjs.dev/config-build
- build: {
- }
+ build: {},
}