I am working on a project that has Vuetify as the design framework. After reading the docs and examples, I am still unsure of how to make my normal design patterns into Vuetify. I have the normal way I'd make a component below but translating it to Vuetify, I am unsure whether or not to use or for each div and just give them a class to put flex on them?
Normally, I would make my component like this:
.product-box-component {
width: 100%;
background-color: grey;
height: 90px;
display: flex;
}
.img-container {
display: flex;
align-items: center;
}
.product-info {
width: 90%;
display: flex;
flex-direction:column;
background:#cecece;
height: 100%;
justify-content: center;
}
.product-name {
align-self: center;
width: 10%
}
.product-price {
align-self: center;
}
<div class="product-box-component">
<div class="img-container">
<img src="https://previews.123rf.com/images/victoroancea/victoroancea1201/victoroancea120100059/12055848-tv-color-test-pattern-test-card-for-pal-and-ntsc.jpg" height="30" width="30"/>
</div>
<div class="product-info">
<div class="name">Prod Name</div>
<div class="color">Blue</div>
</div>
<div class="product-price">
$40
</div>
</div>
I mean there is basically no right or wrong here. I think the benefit of using vuetifys grid system is that you can understand the stylings just from looking at the html. But this can get confusing as well if overdone.
In the middle part you would need to nest multiple v-row and v-col to achieve the flex-column so my prefered way to do this is with the Vuetify flex helpers. I think according to your current workwise (which is also totally fine), you dont have to use vuetify rows and columns at all, but maybe you want to try the flex class helpers. https://vuetifyjs.com/en/styles/flex/. There's a reason they offer both for usage.
<v-row style="height: 90px; width: 100%; background-color: grey">
<v-col class="d-flex align-center">
<img src="https://previews.123rf.com/images/victoroancea/victoroancea1201/victoroancea120100059/12055848-tv-color-test-pattern-test-card-for-pal-and-ntsc.jpg" height="30" width="30"/>
</v-col>
<v-col class="d-flex flex-column justify-center" style="height: 100%; width: 90%; background: :#cecece">
<div class="name">Prod Name</div>
<div class="color">Blue</div>
</v-col>
<v-col align-self="center">
$40
</v-col>
</v-row>
Related
I'm using v-combobox to view a list of v-chip and it looks like this:
I want to add a line break between each chips.
Here is my code:
<v-combobox
:append-icon="false"
style="
padding-right: 30px !important;
padding-left: 30px !important;
"
:search-input.sync="search"
v-model="chips"
:items="items"
chips
clearable
color="#0D47A1"
label="Your actions..."
multiple
readonly="true" :key="chips.name">
<template
v-slot:selection="{ attrs, item, select, selectedSetups }"
style="font-size: 14px; font-family: 'Segoe UI Emoji'">
<v-chip
class="list-group-item"
v-bind="attrs"
:input-value="selectedSetups"
color
label
close
#click="select"
#click:close="RemoveRequirement(item)"
outlined>
<span>{{ item.category }}</span>
<v-divider
class="mx-4"
color="black"
inset
vertical
v-show="item.value.toString() != ''"></v-divider>
<span>{{ item.value.toString() }}</span>
</v-chip>
</template>
</v-combobox>
Any idea on how to achieve that please?
I found a way to do this using css, but this also shifts the dropdown down with every selection. That is probably not desired. Try it out and see for yourself:
div[role=combobox] .v-select__slot .v-select__selections {
display: flex;
flex-direction: column;
align-items: flex-start;
}
I'm practising bootstrap responsive web development, I've managed to make my webpage fairly responsive when I change the width however my middle columns overlap if I resize vertically. Here's the code:
<div class="container-fluid con">
<div class="row">
<div class="col-md-2 d-none d-md-block col1">
</div>
<div class="col-md-6 col2">
<p id="header-p">Full stack developer specialising in responsive website design and smooth user experience. Practical experience in project management, branding strategy, and creative direction; devoted to functional programming and information architecture</p>
<hr id="hr1">
<p id="header-tag">Web Developer - User Experience Designer - Graphic Artist
</p>
</div>
<div class="col-md-2 pic-col">
<img class="img-responsive rounded-circle img-thumbnail" src="#">
</div>
<div class="col-md-2 d-none d-md-block col1">
</div>
</div>
</div>
<div class="container-fluid con2">
<div class="row">
<div class="col-md-2 d-none d-md-block col1"></div>
<div class="col-md-8 port-col"><h2 id="portfolio-header">Portfolio</h2>
<hr id="hr2">
</div>
<div class="col-md-2 d-none d-md-block col1">
</div>
</div>
</div>
And the CSS:
#header-p{
margin-top: 10%;
text-align: center;
color: white;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size:20px;
}
#header-tag{
padding-top: 1rem;
text-align: center;
color: white;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size:20px;
}
.con{
margin: 4rem auto 2rem auto;
}
.col1, .col3{
border: 1px solid #bfbfbf;
background-color: #bfbfbf;
height: 100vh;
}
.col2{
background-color: #cccccc;
height: 60vh;
}
.pic-col{
background-color: #cccccc;
height: 60vh;
}
#portfolio-header{
text-align: center;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 60px;
letter-spacing: 5px;
/*line-height: 90px;*/
max-width: 100%;
color: #b3b3b3;
}
.port-col{
max-height: 100vh;
}
.con2{
margin: 2rem auto 2rem auto;!important
}
the full code is here if I'm missing anything https://codepen.io/Seaplush/pen/rKVLmX
I am having hard time figuring out how to fix a small alignment issue as shown in the fiddle. The text box and 'R' bootstrap label is not aligned on the top.
https://jsfiddle.net/haribalaji/p7Louzq9/
.inline-form-control
{
display: inline-block;
width: 90%;
}
.labelClass
{
display: inline-block;
height: 40px;
}
.label-primary {
background-color: #337ab7;
}
.label {
display: inline;
padding: .2em .6em .3em;
font-size: 75%;
font-weight: 700;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25em;
}
Here is the code
<code>
<form>
<div class="row">
<div class="col-xs-12 col-md-8">
<div class="form-group">
<label for="adrTerm"><span>Adverse Reaction Term</span><span style="color:red;">*</span></label>
<div class="field"><input type="text" name="adrTerm" class="inline-form-control form-control" placeholder="Enter the ADR Term Name" value="" tabindex="1"><span class="labelClass label label-primary">R</span>
<div class="input"></div>
</div>
</div>
</div>
</form>
</code>
This fiddle demonstrates the "R" label being the same height as the input and aligned to its right.
As mentioned in the comments earlier, the markup needed to be much simpler:
<div class="container">
<form>
<div class="form-group">
<label for="adrTerm" class="col-xs-12 control-label text-left">Adverse Reaction Term<span style="color:red;">*</span></label>
<div class="col-xs-11">
<input type="text" name="adrTerm" class="form-control" placeholder="Enter the ADR Term Name" value="" tabindex="1">
</div>
<div class="col-xs-1">
<label class="text-center rLabel">R</label>
</div>
</div>
</form>
</div>
And also, very little custom CSS is required:
.container {
margin: 10px
}
.rLabel {
padding-top: 6px;
padding-bottom: 6px;
background-color: #337ab7;
margin-left: -30px;
color: #fff;
width: 80%;
}
This still may not give you exactly what you want. For example, you may not care for how the "R" label will change width when the window is resized. If so, change the width in the .rLabel class to a fixed width.
Note how the Bootstrap styles are added to the fiddle as an external resource.
Also, note that the use of a container is required.
Updated link to JSFIDDLE
.labelClass
{
display: inline-block;
position:absolute;//added
}
.label {
display: inline;
padding:0 0.6em;//changed
font-size: 75%;
font-weight: 700;
line-height: 1.8;//changed
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25em;
}
Make label position absolute,
Removed unnecessary padding,
Changed line height of label.
Use input group add-on of bootstrap if you are using.
http://v4-alpha.getbootstrap.com/components/input-group/
I'm using Bootstrap 3 - and have two columns with content.
Column one is an image.
Column two is some text.
Now what I want to do is to make the "row" take up the entire height of the browser window AND to have the image in column one AND the text inside column 2 centre horizontally and vertically. I've tried all solution from Stackoverflow, but with no luck.
Here the code I'm using:
<div class="container" style="height:100%;">
<div class="row">
<div class="col-sm-6"> <img src="img/logo_frontpage.png" class="img-responsive center-block" style="height:70%; width:70%" alt=""> </div> <!-- should be vertical centre -->
<div class="col-sm-6">
<!-- start -->
<div id="start" style="display:block;"> <!-- should be vertical centre -->
<h1 class="text-center">Welcome!</h1>
<p class="text-venter">to</p>
<h3 class="text-center" >my site<br /></h3>
</div>
</div>
</div>
</div>
I'm having troubles making the container fill the entire screen area, and vertically centring the two columns.
Stackoverflow is not the only source for CSS techniques. You can find lots of information on CSS-Tricks.com and other places.
DEMO: http://jsbin.com/bayoli/1/
CSS
#media (min-width:768px) {
html,
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
.container.my-container {
display: table;
height: 100%;
}
.my-container .row {
display: table-cell;
height: 100%;
}
.my-container .col-sm-6 {
display: table-cell;
border: 5px dashed pink;
height: 100%;
}
.my-container .col-sm-6 .inner {
display: table;
height: 100%;
width:100%;
}
.my-container .col-sm-6 .inner > div {
display: table-cell;
vertical-align: middle;
width: 100%:;
}
}
/* fluid image */
img.img-full-width {width:100%;}
HTML
<div class="container my-container">
<div class="row">
<div class="col-sm-6">
<div class="inner">
<div>
<img src="http://placehold.it/600x300/555555/FFFFFF&text=image+1" class="img-full-width img-responsive" />
</div>
</div>
</div>
<div class="col-sm-6 one">
<div class="inner">
<div>
<ol>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
<li>Vestibulum auctor dapibus neque.</li>
</ol>
</div>
</div>
</div>
</div>
</div>
I'm trying to destroy descendants of Accordion, that is I have 4 Content Panes within an Accrdion and then when I get new data I want to repopulate the accordion with that data(eg 5 ContentPanes) but the issue is that Once I call destroyDescendants on the accordion the content panes still reside within as dijit__Contained objects left from previous data:
<div class="mblAccordionTitle mblAccordionHasIcon mblAccordionTitleSelected" id="dijit__Contained_0" widgetid="dijit__Contained_0" style="-webkit-user-select: none;">
<a class="mblAccordionTitleAnchor" role="presentation">
<div class="mblAccordionIconParent mblAccordionIconParent2">
<div class="mblSpriteIconParent" style="position: relative; width: 32px; height: 32px;">
<img alt="" src="images/i.png" class="mblSpriteIcon" style="position: absolute; clip: rect(0px 32px 32px 0px ); top: 0px; left: 0px;">
</div>
</div>
<div class="mblAccordionIconParent mblAccordionIconParent1">
<div class="mblSpriteIconParent" style="position: relative; width: 32px; height: 32px;">
<img alt="" src="images/i.png" class="mblSpriteIcon" style="position: absolute; clip: rect(0px 64px 32px 32px); top: 0px; left: -32px;">
</div>
</div>
<div class="mblAccordionTitleTextBox" role="tab" tabindex="0" aria-controls="widget/PersonContainerContentPane" aria -selected="true" aria-posinset="1" aria-setsize="4">
<span class="mblAccordionTitleLabel">John Smith
</span>
</div>
</a>
</div>
Also the contained object is not a child of accordion...
Is there any way to get rid of this when I call destroyDescendants on accordion?
That solved my problem:
for (var i = this.accordion.containerNode.childNodes.length - 1; i >= 0; i--) {
registry.byId(this.accordion.containerNode.childNodes[i].id).destroyRecursive(false);
};
Don't know why destroyDescendants didn't clean up leftover html.