login design ionic | How design a responsive login page in ionic angular

login design ionic | How design a responsive login page in ionic angular

In this login design ionic tutorial we will learn how to design a responsive login and register page in ionic. Most of beginners think how to start design a login page in ionic and apply css to it. Ionic design is same as html design but some tags are different than simple html. like ion-row, ion-col, ion-grid, ion-icon etc. Here we will skip project creation as it is explained in previous blog. For installation and project creation see the blog How install ionic and develop first application So lets start-

Create a page and write the below code in .html file

I have used cdn link here for fontawesome.

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/
font-awesome/4.7.0/css/font-awesome.min.css">
<ion-content class="main_content">
  
  <div class="container_home">
    <div class="form_content">
      <div class="logo_layout">
      <img class="logo" src="../../assets/imgs/logo1.png" />
      </div>
      
      <form class="form">
        <div class="input_layout">
          <ion-icon class="fa fa-user icon" color="gray"></ion-icon>
          <input class="input-field" type="text" placeholder="Email">
        </div>
    
        <div class="input_layout">
          <ion-icon class="fa fa-lock icon" color="gray"></ion-icon>
          <input class="input-field" type="text" placeholder="Password">
        </div>
    
        <ion-row class="check_layout">
          <ion-checkbox color="dark" checked="true">Keep me signed in</ion-checkbox>
          <div class="check-text">Keep me signed in</div>
        </ion-row>
    
        <ion-row class="btn_layout">
          <ion-col text-center>
            <button ion-button block class="btn_login" (click)="goDashboard()">
              Login
            </button>
          </ion-col>
          <ion-col text-center>
            <button ion-button block class="btn_register" (click)="onSignIn()">
              Register
            </button>
          </ion-col>
        </ion-row>
    
        <ion-row class="forgot_layout">
          <ion-col text-center>
            <p class="txt_line" ion-button clear color="block" >
              Change password
            </p>
          </ion-col>
          <ion-col text-center>
            <p class="txt_line" ion-button clear color="block" >
              Forgot password?
            </p>
          </ion-col>
        </ion-row>
        <ion-row class="arrow_layout">
          <p text-center class="arrow" (click)="goDashboard()">
            <i class="fa fa-arrow-right icon"></i>
          </p>
        </ion-row>
      </form>
    </div>
  </div>

  <ion-row class="bottom_layout_blue">
  </ion-row>
  <ion-row class="bottom_layout">
  </ion-row>
</ion-content>


The classes used above have specific css written in .scss file below.

.btn_layout{
 padding-left50px;
 padding-right50px;
 margin-top15px;
}
.main_content{
    flex1;
    background-imageurl('../../assets/imgs/background.jpg');
}

.container_home{
    displayflex;
    flex-directioncolumn;
    width100%;
    positionfixed;
    align-itemscenter;
    justify-contentcenter;
    top10px;
    bottom40px;
    align-itemscenter;
    justify-contentcenter;
}
.form_content{
    width100%;
}
.form{
    margin-top40px;
}
.logo_layout{
    displayflex;
    justify-contentcenter;
}
.logo{
    width100px;
    align-selfcenter;
    positionrelative;
}
.forgot_layout{
    padding-left50px;
    padding-right50px;
}

.check_layout{
    flex1;
    flex-directionrow;
    padding-left40px;
    padding-right40px;
    margin-top10px;
}
.check-text{
    margin-left10px;
}
.txt_line{
    font-size10px;
    font-weight500;
    colorblack;
}
.input_layout{
    flex1;
    flex-directionrow;
    background:silver;
    margin-left30px;
    margin-right30px;
    padding-left10px;
    margin-top15px;
    borderblack;
    border-width5px;
    border-colorblack;
    border-radius6px;
}
.input-field{
    width90%;
    height35px;
    backgroundsilver;
    bordernone;
}
.arrow_layout{
    flex1;
    width100%;
    positionfixed;
    bottom30px;
    justify-contentcenter;
    align-contentcenter;
}
.arrow{
    height30px;
    width30px;
    padding5px;
    align-selfcenter;
    border-radius15px;
    background-color#ED1D24;
    colorwhite;
}
.bottom_layout{
    width100%;
    height8px;
    positionfixed;
    bottom0;
    background-color#ED1D24;
}
.bottom_layout_blue{
    width100%;
    height10px;
    positionfixed;
    bottom8px;
    background-color#356AA6;
}
.btn_login{
    background-color#ED1D24;
}
.btn_register{
    background-color#356AA6;
}

click method have defined in .ts file like below..

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { DashboardPage } from '../dashboard/dashboard';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  constructor(public navCtrlNavController) {

  }
// click method
  goDashboard(){
    this.navCtrl.setRoot(DashboardPage);
  }
}

The above design will look like below   

                                                    


   
                                      

                                                 x------- Happy coding... ---------x

Comments

Popular posts from this blog

What is ionic framework

How install Ionic and develop first application