adding latest
This commit is contained in:
212
firebase.md
212
firebase.md
@@ -10,18 +10,20 @@ List of errors: <https://firebase.google.com/docs/reference/js/firebase.auth.Aut
|
||||
You can catch the error and use if/else to capture the specific error.
|
||||
|
||||
```javascript
|
||||
firebase.auth().createUserWithEmailAndPassword(email, password)
|
||||
.catch(function(error) {
|
||||
// Handle Errors here.
|
||||
var errorCode = error.code;
|
||||
var errorMessage = error.message;
|
||||
if (errorCode == 'auth/weak-password') {
|
||||
alert('The password is too weak.');
|
||||
} else {
|
||||
alert(errorMessage);
|
||||
}
|
||||
console.log(error);
|
||||
});
|
||||
firebase
|
||||
.auth()
|
||||
.createUserWithEmailAndPassword(email, password)
|
||||
.catch(function(error) {
|
||||
// Handle Errors here.
|
||||
var errorCode = error.code;
|
||||
var errorMessage = error.message;
|
||||
if (errorCode == "auth/weak-password") {
|
||||
alert("The password is too weak.");
|
||||
} else {
|
||||
alert(errorMessage);
|
||||
}
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
|
||||
Firebase User object:
|
||||
@@ -48,7 +50,6 @@ mention using `reauthenticateWithCredential`. This is only needed if using a 3rd
|
||||
|
||||
`yarn add @mdi/font -D`
|
||||
|
||||
|
||||
## Controlling layouts
|
||||
|
||||
### Spacing
|
||||
@@ -96,9 +97,9 @@ In a `<v-row>` you can have many `<v-col>`. You can have as many of these and us
|
||||
|
||||
```html
|
||||
<v-col cols="4" class="appTitle d-flex justify-start">
|
||||
<v-toolbar-title>
|
||||
<v-toolbar-title>
|
||||
Savvy Firebase tutorial
|
||||
</v-toolbar-title>
|
||||
</v-toolbar-title>
|
||||
</v-col>
|
||||
```
|
||||
|
||||
@@ -137,7 +138,6 @@ For example, to break on the medium viewport and have the second layout apply to
|
||||
|
||||
Here the second layout does not include the medium layout, hence the medium layout will apply to it.
|
||||
|
||||
|
||||
## App bar
|
||||
|
||||
### Gradient as a background colour
|
||||
@@ -148,17 +148,17 @@ If you want to apply a fade gradient colour on top of the image, you should use
|
||||
|
||||
```html
|
||||
<v-app-bar
|
||||
flat
|
||||
app
|
||||
class="hidden-sm-and-down"
|
||||
src="https://www.stellamccartney.com/cloud/smcwp/uploads/2016/01/1920x1080-black-solid-color-background.jpg"
|
||||
flat
|
||||
app
|
||||
class="hidden-sm-and-down"
|
||||
src="https://www.stellamccartney.com/cloud/smcwp/uploads/2016/01/1920x1080-black-solid-color-background.jpg"
|
||||
>
|
||||
<template v-slot:img="{props}">
|
||||
<template v-slot:img="{props}">
|
||||
<v-img
|
||||
v-bind="props"
|
||||
gradient="to top right, rgba(100,115,201,.7), rgba(25,32,72,.7)"
|
||||
></v-img>
|
||||
</template>
|
||||
v-bind="props"
|
||||
gradient="to top right, rgba(100,115,201,.7), rgba(25,32,72,.7)"
|
||||
></v-img> </template
|
||||
></v-app-bar>
|
||||
```
|
||||
|
||||
If you want to just use a gradient (no img), then apply a solid colour image and then use a scoped slot with the gradient you want.
|
||||
@@ -169,7 +169,7 @@ When linking to routes, you should use `<router-link>`:
|
||||
|
||||
```html
|
||||
<router-link :to="{ name: 'Login' }">
|
||||
<span class="mr-3">Sign In</span>
|
||||
<span class="mr-3">Sign In</span>
|
||||
</router-link>
|
||||
```
|
||||
|
||||
@@ -177,7 +177,7 @@ You can apply transitions on a route change:
|
||||
|
||||
```html
|
||||
<transition name="slide">
|
||||
<router-view></router-view>
|
||||
<router-view></router-view>
|
||||
</transition>
|
||||
```
|
||||
|
||||
@@ -201,8 +201,8 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
video: require("../assets/videos/optical.mp4")
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
@@ -220,8 +220,8 @@ You can find full props to customise the video:
|
||||
You can set a gradient to the image to improve visibility:
|
||||
|
||||
```javascript
|
||||
style=" height: 100vh;"
|
||||
overlay="linear-gradient(45deg,#2a4ae430,#fb949e6b)"
|
||||
style = " height: 100vh;";
|
||||
overlay = "linear-gradient(45deg,#2a4ae430,#fb949e6b)";
|
||||
```
|
||||
|
||||
## Dynamically hide app bar
|
||||
@@ -242,7 +242,7 @@ Use the Vuex store to determine when you want to hide the app bar:
|
||||
state.fullScreen = fullScreen;
|
||||
}
|
||||
},
|
||||
```
|
||||
```
|
||||
|
||||
and create the lifecycle actions in the component that houses the appbar:
|
||||
|
||||
@@ -258,13 +258,13 @@ and create the lifecycle actions in the component that houses the appbar:
|
||||
Then you can wrap the appbar in a `v-if`:
|
||||
|
||||
```html
|
||||
<v-app-bar
|
||||
flat
|
||||
app
|
||||
class="hidden-sm-and-down"
|
||||
color="#EEEEEE"
|
||||
v-if="!this.$store.getters.fullScreen"
|
||||
>
|
||||
<v-app-bar
|
||||
flat
|
||||
app
|
||||
class="hidden-sm-and-down"
|
||||
color="#EEEEEE"
|
||||
v-if="!this.$store.getters.fullScreen"
|
||||
></v-app-bar>
|
||||
```
|
||||
|
||||
## Change default font colour
|
||||
@@ -289,10 +289,10 @@ Then create a new class `fontColor` to apply to the router, and edit the default
|
||||
Then in `App.vue` apply the `fontColor` class to the `<v-app>`:
|
||||
|
||||
```html
|
||||
<v-app
|
||||
:style="{ background: $vuetify.theme.themes.light.background }"
|
||||
class="fontColor"
|
||||
>
|
||||
<v-app
|
||||
:style="{ background: $vuetify.theme.themes.light.background }"
|
||||
class="fontColor"
|
||||
></v-app>
|
||||
```
|
||||
|
||||
## Grids
|
||||
@@ -312,7 +312,7 @@ The grid system applies to `<v-row>` and you can use the following props:
|
||||
For `<v-col>` only `align-self` is available. To align content on a column, or any other element like a card, you should use the same classes as in the flex system. For example:
|
||||
|
||||
```html
|
||||
<v-col cols="5" align-self="start" class="d-flex justify-end pr-0">
|
||||
<v-col cols="5" align-self="start" class="d-flex justify-end pr-0"></v-col>
|
||||
```
|
||||
|
||||
## Container filling whole page
|
||||
@@ -322,6 +322,49 @@ A container should be used whenever you want to use `<v-col>` and `<v-row>`. To
|
||||
- `fill-height`
|
||||
- `fluid`.
|
||||
|
||||
## Multi column layouts
|
||||
|
||||
An example can be found here:
|
||||
<https://git.panaetius.co.uk/web-development/savvy-firebase/src/branch/base-template/src/views/forms/LoginForm.vue>
|
||||
|
||||
You can make use of the above to create dynamic layouts.
|
||||
|
||||
One idea (for a login page) might be to use the following nested layout:
|
||||
|
||||
### Container
|
||||
|
||||
A `<v-container>` with `fill-height` and `fluid` props.
|
||||
|
||||
### Row
|
||||
|
||||
A `<v-row>`
|
||||
|
||||
### Columns
|
||||
|
||||
A `<v-col>` with `align-self="stretch"` and `class="d-flex flex-column justify-space-between"`.
|
||||
|
||||
`align-self=stretch` allows each child of the column to _stretch_ (<https://developer.mozilla.org/en-US/docs/Web/CSS/align-items)>.
|
||||
|
||||
`class="d-flex flex-column justify-space-between"` allows each child of the column to flex - with justify-space-between putting them equally apart top to bottom. It's used to equally space out the _rows_ inside this column. Even though we are not using `<v-row>`.
|
||||
|
||||
### Cards
|
||||
|
||||
A `<v-card>` with `class="d-flex align-end flex-column"`.
|
||||
|
||||
`class="d-flex align-end flex-column"` allows content inside the card to flex. The `align-end` means they will be on the right hand side and flex-column means they are flexing across columns.
|
||||
|
||||
To make text align right, you should use the `text-right` class:
|
||||
|
||||
`<p class="whiteText font-regular text-right mb-0">`
|
||||
|
||||
This is because although the `<p>` element will align to the right becasue of the class from the `<v-card>`, the text inside will align to the left.
|
||||
|
||||
We can add `color="rgb(0, 0, 0, 0)"` and `flat` props to the card - allowing it to seamlessly blend in with the background.
|
||||
|
||||
We can add mulitple cards to this layout in this column - and control how they are spaced with the props on the column.
|
||||
|
||||
We can add `<v-spacer>` and then add additional colums with the same props to add content in a column like manner.
|
||||
|
||||
## Helper classes
|
||||
|
||||
### Spacing
|
||||
@@ -344,7 +387,7 @@ There are two types of styles: Typography Display Classes and Style and Weight C
|
||||
|
||||
Examples include `.display-2` and `.font-weight-black`.
|
||||
|
||||
### Replace Vuetify default font with own
|
||||
### Replace Vuetify default font with custom
|
||||
|
||||
Fonts needed to replace the Roboto default:
|
||||
|
||||
@@ -362,3 +405,82 @@ Fonts needed to replace the Roboto default:
|
||||
|
||||
If font styles dont exist then substitute them with the closest type.
|
||||
|
||||
An example of a stylesheet replacing all of these with the Gilroy font is here:
|
||||
<https://git.panaetius.co.uk/web-development/savvy-firebase/src/branch/base-template/src/scss/_variables.scss>
|
||||
|
||||
## Custom colour theme
|
||||
|
||||
Creating a custom colour theme for Vuetify is straightforward.
|
||||
|
||||
<https://mycolor.space> is a good resource to generate palettes from a colour.
|
||||
|
||||
See <https://vuetifyjs.com/en/customization/theme/#customizing> for details on customising a theme.
|
||||
|
||||
### Editable colours
|
||||
|
||||
You change the `Vuetify` object in `vuetify.js`:
|
||||
|
||||
```javascript
|
||||
export default new Vuetify({
|
||||
icons: {
|
||||
iconfont: "mdi"
|
||||
},
|
||||
theme: {
|
||||
themes: {
|
||||
light: {
|
||||
primary: "#051937",
|
||||
secondary: "#374366",
|
||||
accent: "#d4a418",
|
||||
background: "#e8e8e8"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
These are the editable colours you can choose for Vuetify
|
||||
|
||||
```json
|
||||
{
|
||||
"primary": "#1976D2",
|
||||
"secondary": "#424242",
|
||||
"accent": "#82B1FF",
|
||||
"error": "#FF5252",
|
||||
"info": "#2196F3",
|
||||
"success": "#4CAF50",
|
||||
"warning": "#FFC107"
|
||||
}
|
||||
```
|
||||
|
||||
These follow the Material style of colours:
|
||||
<https://material.io/design/color/the-color-system.html#color-theme-creation>
|
||||
|
||||
The accent colour in Vuetify isn't really specified in the Material colour design - typically the secondary colour would be used as an accent colour - with shades of the primary used throughout the UI. However in some themes you may wish to use primary and secondary together, and have a seperate accent colour.
|
||||
|
||||
<https://material.io/design/color/the-color-system.html#color-theme-creation>
|
||||
|
||||
### Colour variants
|
||||
|
||||
Vuetify will automatically generate darken and lighten colour variants of the primary and secondary colours in the theme. If you want to control these manually you can do so following the instructions:
|
||||
<https://vuetifyjs.com/en/customization/theme/#custom-theme-variants>
|
||||
|
||||
The variants you can use are:
|
||||
|
||||
```json
|
||||
{
|
||||
"base": "string",
|
||||
"lighten5": "string",
|
||||
"lighten4": "string",
|
||||
"lighten3": "string",
|
||||
"lighten2": "string",
|
||||
"lighten1": "string",
|
||||
"darken1": "string",
|
||||
"darken2": "string",
|
||||
"darken3": "string",
|
||||
"darken4": "string"
|
||||
}
|
||||
```
|
||||
|
||||
You can apply these as a class to the object you want to darken/lighten.
|
||||
For example:
|
||||
`<v-btn color="primary" class="darken-2">Hello</v-btn>`
|
||||
|
||||
Reference in New Issue
Block a user