瀏覽代碼

Home page UI

master
kj1352 4 年之前
父節點
當前提交
99348ed35f
共有 4 個檔案被更改,包括 162 行新增20 行删除
  1. +35
    -10
      src/app/home/home.page.html
  2. +122
    -9
      src/app/home/home.page.scss
  3. +3
    -1
      src/app/tabs/tabs.page.scss
  4. +2
    -0
      src/theme/variables.scss

+ 35
- 10
src/app/home/home.page.html 查看文件

@@ -3,7 +3,7 @@
<section class="segments"> <section class="segments">
<button [ngClass]="{'active' : selectedTab === 'news'}" <button [ngClass]="{'active' : selectedTab === 'news'}"
(click)="selectedTab = 'news'"> News </button>
(click)="selectedTab = 'news'"> News ({{ newsData.length }}) </button>
<button [ngClass]="{'active' : selectedTab === 'videos'}" <button [ngClass]="{'active' : selectedTab === 'videos'}"
(click)="selectedTab = 'videos'"> Videos </button> (click)="selectedTab = 'videos'"> Videos </button>
</section> </section>
@@ -15,20 +15,45 @@
<figure> <figure>
<img [src]="news.image"> <img [src]="news.image">
</figure> </figure>
</div>


<h4> {{ news.heading }} </h4>
<button *ngIf="news.type === 'VIDEO'">
<ion-icon name="play"></ion-icon>
</button>


<p>
{{ news.description }}
</p>
<div class="action-buttons">
<button>
<ion-icon name="heart-outline"></ion-icon>
<button *ngIf="news.type === 'ARTICLE'">
<ion-icon name="newspaper"></ion-icon>
</button> </button>
</div> </div>


<section class="content">
<h4> {{ news.heading }} </h4>

<p>
{{ news.description }}
</p>
</section>
<section class="action-buttons">
<section class="shortcuts">
<button>
<ion-icon name="share-social-outline"></ion-icon>
</button>

<button (click)="news.isLiked = !news.isLiked"
[ngClass]="{'active' : news.isLiked}">
<ion-icon *ngIf="!news.isLiked" name="heart-outline"></ion-icon>
<ion-icon *ngIf="news.isLiked" name="heart"></ion-icon>
<span> {{ news.isLiked ? news.likes + 1 : news.likes }} </span>
</button>
</section>

<button class="read-more">
<span *ngIf="news.type === 'ARTICLE'"> Read More </span>
<span *ngIf="news.type === 'VIDEO'"> Watch </span>
<ion-icon name="chevron-forward-outline"></ion-icon> </button>
</section>

</ion-slide> </ion-slide>
</ion-slides> </ion-slides>




+ 122
- 9
src/app/home/home.page.scss 查看文件

@@ -5,26 +5,28 @@ ion-content {
.main-header { .main-header {
background: -webkit-linear-gradient(180deg, rgba(var(--brand-red-rgb), 0.6) 50%, rgba(var(--brand-red-rgb), 1)); background: -webkit-linear-gradient(180deg, rgba(var(--brand-red-rgb), 0.6) 50%, rgba(var(--brand-red-rgb), 1));
-webkit-background-clip: text; -webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent; -webkit-text-fill-color: transparent;
font-size: 40px;
font-size: 2.5rem;
font-weight: 700; font-weight: 700;
letter-spacing: 1px; letter-spacing: 1px;
padding: 0px 30px;
margin: 30px 0px;
padding: 0px 7%;
margin: 5% 0%;
} }


.segments { .segments {
display: flex; display: flex;
align-items: stretch; align-items: stretch;
width: 100%; width: 100%;
padding: 0px 30px;
padding: 0px 7%;
margin: 5% 0%;


button { button {
background-color: transparent; background-color: transparent;
color: white; color: white;
font-size: 18px;
font-size: 1.2rem;
font-weight: 400; font-weight: 400;
margin-right: 15px;
margin-right: 5%;
position: relative; position: relative;
opacity: 0.5; opacity: 0.5;


@@ -47,25 +49,136 @@ ion-content {
} }


ion-slides { ion-slides {
margin: 40px 0px;
margin: 12% 0%;
height: calc(100vh - 40%);


ion-slide { ion-slide {
display: block;
background-color: white;
display: block;
overflow: hidden;
border-radius: 7px;
text-align: left;
align-self: start;
height: 100%;
} }


.image-holder { .image-holder {
position: relative; position: relative;
height: 40%;
overflow: hidden;

button {
width: 40px;
height: 40px;
position: absolute;
bottom: 10px;
right: 10px;
display: flex;
align-items: center;
justify-content: center;
background-color: rgba(#ffff, 0.5);
border-radius: 50%;

ion-icon {
color: white;
font-size: 20px;
}
}


figure { figure {
margin: 0; margin: 0;
display: block; display: block;
width: 100%; width: 100%;
height: 100%;
filter: brightness(60%);


img { img {
height: 100%;
object-fit: cover;
display: block; display: block;
width: 100%; width: 100%;
} }
} }
} }

.content {
background-color: white;
padding: 5%;
height: calc(60% - 50px);
overflow: hidden;
margin-top: -1px;
border-bottom: 1px solid rgba(var(--light-grey-rgb), 0.8);
}

h4 {
font-size: 1.2rem;
margin: 0px;
line-height: 1.5;
font-weight: 500;
color: var(--brand-black);
}
p {
margin: 5px 0px 0px 0px;
font-size: 0.9rem;
line-height: 1.5;
font-weight: 400;
display: -webkit-box;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
color: var(--light-grey);
overflow: hidden;
}

.action-buttons {
background-color: white;
display: flex;
justify-content: space-between;
width: 100%;
height: 50px;
margin-top: -1px;
padding: 0 3%;

.shortcuts {
display: flex;
align-items: stretch;
height: 100%;

button {
background-color: transparent;
margin-right: 5px;

&.active {
ion-icon, span {
color: var(--brand-red);
}
}

span {
vertical-align: middle;
color: var(--light-grey);
}
ion-icon {
vertical-align: middle;
color: var(--brand-black);
font-size: 1.2rem;
}
}
}

.read-more {
background-color: transparent;
font-size: 0.9rem;
color: var(--brand-red);
font-weight: 400;

ion-icon {
color: var(--brand-black);
font-size: 1.2rem;
vertical-align: middle;
color: var(--brand-red);
}
}
}

} }

+ 3
- 1
src/app/tabs/tabs.page.scss 查看文件

@@ -1,10 +1,12 @@
ion-tab-bar { ion-tab-bar {
--background: var(--brand-black); --background: var(--brand-black);
--border: none; --border: none;
margin-top: -1px;


ion-tab-button { ion-tab-button {
ion-icon { ion-icon {
color: white; color: white;
font-size: 20px;


&:nth-child(1) { &:nth-child(1) {
display: block; display: block;
@@ -31,7 +33,7 @@ ion-tab-bar {


&:nth-child(2) { &:nth-child(2) {
ion-icon { ion-icon {
font-size: 35px;
font-size: 30px;
border-radius: 50%; border-radius: 50%;
overflow: hidden; overflow: hidden;
// animation: rippleButton 3s infinite; // animation: rippleButton 3s infinite;


+ 2
- 0
src/theme/variables.scss 查看文件

@@ -80,6 +80,8 @@
--brand-black: #272727; --brand-black: #272727;
--brand-red: #ED1C24; --brand-red: #ED1C24;
--brand-red-rgb: 237, 28, 36; --brand-red-rgb: 237, 28, 36;
--light-grey: #666666;
--light-grey-rgb: 102, 102, 102;


} }




Loading…
取消
儲存