I have a ticket component in vue:
<template>
<div class="col-lg-3 col-md-6 col-sm-12 col-xs-12 single-ticket-col">
<div class="single-ticket">
<div type="ticket" class="widget --flex-column">
<div class="top --flex-column">
<div class="ticket-type -bold">{{ product.attributes.name }}</div>
<!-- TODO: Change image url to product's image-->
<img :src="image" alt="Product Image" />
<div class="deetz --flex-row-j!sb">
<div class="event --flex-column">
<div class="date">{{ formatDate(product.attributes.date) }}</div>
<div class="price">€ {{ priceCalculationCheapest(product) }} - € {{ priceCalculationExpensive(product) }} <span>(Inkl. Mwst.)</span></div>
<div v-for="variation in product.attributes.variations">
<div class="variation">
{{variation.name}}
<div v-if="variation.scales.length != 0">
<div v-for="scale in variation.scales">
{{scale.from_amount}} for € {{scale.price_incl_vat}}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="rip"></div>
<div class="bottom --flex-row-j!sb">
<router-link :to="{name: 'products', params: {id: product.id}}" class="btn button">Auswählen</router-link>
</div>
</div>
</div>
</div>
</template>
And some tickets have extra information, that's why they are not in the same height sometimes as you can see in the picture:
As a main div of the component I defined as all-tickets and I wrote my css like this:
.all-tickets {
display: flex;
width: 100%;
}
.all-tickets .single-ticket-col {
flex: 1;
}
But I am not successful. Could you please help me in this topic how can i make them in the same height?
Related
I have been using Hugo to build up my website, however, I am having trouble making bootstrap cards of equal height even after using the h-100 class in the card div (as mentioned in a number of SO posts). I have copied my HTML code below.
I am guessing something in the css must be overriding the class.
Any advice would be appreciated.
<section id="blog-posts">
<div class="container-fluid ">
<div class="row text-center">
<div class="col-lg-12">
<h2 class="section-heading">Latest Blog Posts</h2>
<div class="section-underline"></div>
</div>
{{- range ( where site.RegularPages "Section" "blog" | first 3 ) }}
<div class="container">
<div class="row">
<div class="col-lg-4 col-md-6 col-sm-12 mb-5">
<div class="card h-100">
<div class="card-img img-fluid">
<!-- <div class="blog-cat-tag">Test</div> -->
{{ if isset .Params "featured_image" }}<img class="blog-image" src="{{ index .Params "featured_image"}}" alt="...">{{end}}
</div>
<div class="card-body">
<div class="project-title">{{ .Title }}</div>
<p class='card-text'>{{ .Summary }}</p>
Read More
<!-- <a class="viewmore" href="">Read More</a> -->
</div>
<div class="index-blog-post-details">
<div class="index-blog-post-icons">
<i class="far fa-calendar-alt"></i> {{- .Date.Format "January 2, 2006" -}}
<i class="far fa-clock"></i> {{ .ReadingTime }} min read
</div>
</div>
</div>
</div>
{{ end}}
</div>
</div>
</div>
I'm trying to implement card bootstrapping in my .html but I cannot get it to be centered. Please see the code below and help
<h1> 10 Games Recommended Based on {{ selected }} </h1>
<div class = "container">
<div class="recommendations">
{% for name in names_list %}
<div class="card-group">
<div class="card text-center" style="Max-width: 30%;">
<!-- <img src="..." class="card-img-top" alt="..."> -->
<div class="card-body">
<h5 class="card-title"> {{ name }}</h5>
<div class = 'card-body'>
<p1 class = "card-text">Overall Reviews: {{games[name]['rating'] }}</p1>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
I apologize for the mess but the way my app is giving results is pushed to the left like this.
My style is below
<style>
p {font-size: 30px;}
p1 {font-size: 13px;}
a {color:navy;
font-size: 20px;}
body {text-align: center;}
body {background-color: lightblue;}
</style>
Is there anyway I can center these or align them side by side when using loop?
You're missing .row and .col classes. Add them to make it.
<h1>10 Games Recommended Based on {{ selected }}</h1>
<div class="container">
<div class="row">
<div class="recommendations">
{% for name in names_list %}
<div class="col-3">
<div class="card-group">
<div class="card text-center" style="max-width: 30%">
<!-- <img src="..." class="card-img-top" alt="..."> -->
<div class="card-body">
<h5 class="card-title">
{{ name }}
</h5>
<div class="card-body">
<p1 class="card-text"
>Overall Reviews: {{games[name]['rating'] }}</p1
>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
Just note that .col-3 is supposed to be repeated and .row should be parent.
I have following scenario:
app.component.html
<app-card>
This is the card body
</app-card>
card.component.html
<div class="card">
<div class="card-header">
Header
</div>
<div class="card-body">
</div>
</div>
Is there a simple way (like an interpolation) to render the text This is the card body into <div class="card-body">?
Use ng-content:
<div class="card">
<div class="card-header">
Header
</div>
<div class="card-body">
<ng-content></ng-content>
</div>
</div>
in app.component.html file
try below code
<ng-content>
{{ write your property here }}
</ng-content>
I am working on moving chunks of code from being static code within my Views components into actual reusable Components.
I have moved what is called my TrainerCards code into a separate component and the cards used to display nicely as 3 to a row when they were hard coded in my TrainerIndex.vue, but now that they are being passed as a component, they only render as 1 per row, and I don't know why.
TrainerIndex.vue -
<div class="row">
<div class="col-md-4">
<TrainerCards v-for="trainer in orderBy(filterBy(trainers, searchText), sortAttribute, sortAscending)" :key="trainer.id" :trainer="trainer"/>
</div>
</div>
`
TrainerCards.vue -
<template>
<div class="card card-profile">
<div class="card-img-top">
<router-link v-bind:to="'/trainers/' + trainer.id">
<img class="img" :src="(trainer.avatar)" />
</router-link>
</div>
<div class="card-body">
<h4 class="card-title">{{trainer.full_name}}</h4>
<h6 class="card-category">{{trainer.location}}</h6>
<div class="card-footer">
<TrainerTags v-for="tag in trainer.tags" :key="tag.id" :tag="tag"/>
</div>
</div>
</div>
</template>
Any idea on how to get them to display properly?
Your col-md-4 class is what makes them fill 1/3 of the area, but that is now outside your component and not repeating. Move that div inside:
<div class="row">
<TrainerCards v-for="trainer in orderBy(filterBy(trainers, searchText), sortAttribute, sortAscending)" :key="trainer.id" :trainer="trainer"/>
</div>
<template>
<div class="col-md-4">
<div class="card card-profile">
<div class="card-img-top">
<router-link v-bind:to="'/trainers/' + trainer.id">
<img class="img" :src="(trainer.avatar)" />
</router-link>
</div>
<div class="card-body">
<h4 class="card-title">{{trainer.full_name}}</h4>
<h6 class="card-category">{{trainer.location}}</h6>
<div class="card-footer">
<TrainerTags v-for="tag in trainer.tags" :key="tag.id" :tag="tag"/>
</div>
</div>
</div>
</div>
</template>
I have a ng-repeat that has a variable height.
If I use a fixed height everything looks good. But I need the height of the parent panel to adjust automatically according to the ng-repeat child elements, otherwise I have overflow problems.
Is there any way to do this?
With Fixed height (see overflow at the bottom):
Without Fixed Height:
The code of the panels:
<div class="my-panel" ng-repeat="x in month.days">
<div class="panel-today" ng-show="x.today">
TODAY
</div>
<div class="panel" ng-class="x.panel_class">
<div class="panel-heading {{x.weekend}}">{{x.day}} {{x.date | date : 'dd-MM'}}</div>
<div class="panel-body my-panel-body">
<div ng-show="x.suspension != ''" style="width: 100%; text-align: center">
<b>{{x.suspension}}</b>
</div>
<div ng-show="x.suspension == ''">
<div class="well well-sm day-well">
<div class="day_period">
<div class="pull-right">
{{x.times.day.from}}<br/>
{{x.times.day.to}}
</div>
<div class="day_head">DAY</div>
</div>
<div ng-repeat="grade in x.staff.day.m">
<div class="letterCircleM">
{{grade.code}}
</div> S SIPHO
</div>
<div ng-repeat="grade in x.staff.day.f" class="letterCircleF">
{{grade.code}}
</div>
</div>
<div class="well well-sm day-well">
<div class="day_period">
<div class="pull-right">
{{x.times.night.from}}<br/>
{{x.times.night.to}}
</div>
<div class="day_head">NIGHT</div>
</div>
<div ng-repeat="grade in x.staff.night.m">
<div class="letterCircleM">
{{grade.code}}
</div> S SIPHO
</div>
<div ng-repeat="grade in x.staff.night.f" class="letterCircleF">
{{grade.code}}
</div>
</div>
</div>
</div>
<div class="panel-footer">
<div class="panel-suspend" ng-show="x.suspension != ''">
SUSPENDED
</div>
<div ng-show="x.suspension == ''">
{{x.contract}}
</div>
</div>
</div>
</div>
If fixed height works for you, why don't you add it to the parent based on the length of the data you are repeating in ng-repeat via ng-style?
ng-style="{
'height': 30 * RepeatData.length + 'px'
}
30 is the height of one "repeated" block