QuizComponent

Here's another component with a terrible layout; let's do our best to improve it.

Here's the new quiz.component.html template file:

<div class="quiz">
<div class="quiz-details">
<div class="quiz-image">
<img src="https://lorempixel.com/150/150/?random=
{{quiz.Id}}"
alt="{{quiz.Title}}" class="img-circle">
</div>
<div class="quiz-info-block">
<div class="quiz-heading">
<h2>{{quiz.Title}}</h2>
<span class="help-block">{{quiz.Description}}</span>
<!--<span class="help-block">Created by User # on
{{quiz.CreatedDate}}</span>-->
</div>

<ul class="navigation">
<li class="active">
<a data-toggle="tab" href="#description">
<span class="glyphicon glyphicon-user"></span>
&amp;nbsp; Description
</a>
</li>
<li>
<a data-toggle="tab" href="#stats">
<span class="glyphicon glyphicon-stats"></span>
&amp;nbsp; Stats
</a>
</li>
<li>
<a data-toggle="tab" href="#share">
<span class="glyphicon glyphicon-share-alt">
</span>
&amp;nbsp; Share
</a>
</li>
</ul>
<div class="quiz-body">
<div class="tab-content">
<div id="description" class="tab-pane active">
{{quiz.Text}}
</div>
<div id="stats" class="tab-pane">
TO-DO
</div>
<div id="share" class="tab-pane">
TO-DO
</div>
</div>
</div>

<div class="commands">
<a [routerLink]="['/quiz', quiz.Id, 'take']"
class="btn btn-success">
<span class="glyphicon glyphicon-education"></span>
&amp;nbsp; Take the Test!
</a>
<a [routerLink]="['/home']"
class="btn btn-default">
<span class="glyphicon glyphicon-backward"></span>
&amp;nbsp; Back
</a>
<div class="edit">
<input type="button" value="Edit"
(click)="onEdit()"
class="btn btn-sm btn-warning" />
<input type="button" value="Delete"
(click)="onDelete()"
class="btn btn-sm btn-danger" />
</div>
</div>
</div>
</div>
</div>

Also, here's the quiz.component.less style sheet file:

.quiz {
position: relative;
padding: 0;
text-align: center;
width: 80%;

@media (max-width: 767px) {
width: 100%;
}

.quiz-details {
.quiz-image {
position: relative;
z-index: 1;
width: 100%;
text-align: center;

img {
width: 150px;
height: 150px;
clear: both;
margin: auto;
position: relative;
background-color: #ffffff;
border: 1px solid #707d8c;
padding: 2px;
}
}

.quiz-info-block {
width: 100%;
border-radius: 20px;
position: absolute;
top: 80px;
background: #f0f0f0;
z-index: 0;
padding: 60px 0 30px 0;

.quiz-heading {
width: 100%;
text-align: center;
margin: 10px 0 0;
}

.navigation {
margin: 20px 15px 0px 15px;
padding: 0;
list-style: none;
border-bottom: 1px solid #a3aab1;

li {
display: inline-block;
margin: 0 0 -6px 0;
padding: 0;

a {
background: transparent;
border-radius: 10px 10px 0 0;
padding: 10px 30px;
float: left;
}

&amp;.active a {
background: #4189C7;
color: #fff;
}
}
}

.quiz-body {
padding: 20px 20px 30px 20px;

.tab-content {
h4 {
width: 100%;
margin: 10px 0;
color: #333;
}
}
}

.commands {
border-top: 1px solid #dddddd;
width: 80%;
padding: 15px 0 0 0;
margin: 15px auto 0 auto;

.btn {
min-width: 140px;
margin: 0 10px;
}

.edit {
border-top: 1px solid #dddddd;
width: 80%;
padding: 15px 0 0 0;
margin: 15px auto 0 auto;
}
}
}
}
}

There's nothing new here; as usual, we dropped some Bootstrap default classes and added a couple of new things here and there, such as the Back button--to route back our users to the Home view. We also took the chance to implement the lorempixel.com placeholder image here, this time with a bigger size (150 px), as expected for a detail page.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.142.166