How can I move the green text under the image? - html

How can I move the green text from the image attached under the image icon?
I need to move it just under the image. I am using ReactJS and HTML. The text appears when a therapist has paid for their account.
<Link to={`/therapist/profile/${this.therapist.id}`} target="_blank" onClick={this.props.handleViewProfileGuest.bind(this, this.props.therapist.id)}>
<li key={this.props.index} className="tc-list-item">
{/* Avatar Container */}
<div className="tc-image-container">
<img src={this.getAvatarUrl(this.therapist)} alt='therapist-avatar' />
</div>
{/* User Profile Container */}
<div className="tc-info-container">
{/* Name & Title */}
<div className="tc-main-info">
<span className="tc-u-name">{`${this.therapist.firstName} ${this.therapist.lastName}, `}</span>
<span className="tc-u-title"> { ` ${this.therapist.title || 'Therapist'}` }</span>
</div>
<div className="flags-row">
{this.renderVerifiedFlag()}
{this.renderInsuranceFlag()}
</div>
{/* Details */}
<div className="tc-details-info">
{/* Email */}
<div className="tr-reviews-row">
<Rating placeholderRating={this.therapist.avgScore || 0}
emptySymbol={<img src={ratingStarEmpty} className="icon" alt="ratingEmpty"/> }
placeholderSymbol={<img src={ratingStarFull} className="icon" alt="ratingFull" />}
readonly/>
<span className="tr-reviews-value">{ `(${this.therapist.reviewCnt} reviews)` }</span>
</div>
{/* Phone */}
{this.renderContactInfo()}
</div>
</div>
<ReactTooltip type="info" place="right"/>
</li>
</Link>
and here is the css part
& .tc-image-container {
width: 130px;
height: 130px;
border-radius: 15px;
overflow: hidden;
}
& .tc-image-container img {
width: 100%;
height: 100%;
}
& .tc-info-container {
//margin-left: 140px;
flex: 1;
padding-left: 50px;
}

If I'm understanding your question correctly, its very simple... just move the div to the correct location in your html.
<Link to={`/therapist/profile/${this.therapist.id}`} target="_blank" onClick={this.props.handleViewProfileGuest.bind(this, this.props.therapist.id)}>
<li key={this.props.index} className="tc-list-item">
{/* Avatar Container */}
<div className="tc-image-container">
<img src={this.getAvatarUrl(this.therapist)} alt='therapist-avatar' />
</div>
<!-- Moved it to here -- >
<div className="flags-row">
{this.renderVerifiedFlag()}
{this.renderInsuranceFlag()}
</div>
{/* User Profile Container */}
<div className="tc-info-container">
{/* Name & Title */}
<div className="tc-main-info">
<span className="tc-u-name">{`${this.therapist.firstName} ${this.therapist.lastName}, `}</span>
<span className="tc-u-title"> { ` ${this.therapist.title || 'Therapist'}` }</span>
</div>
<!-- text was here -->
{/* Details */}
<div className="tc-details-info">
{/* Email */}
<div className="tr-reviews-row">
<Rating placeholderRating={this.therapist.avgScore || 0}
emptySymbol={<img src={ratingStarEmpty} className="icon" alt="ratingEmpty"/> }
placeholderSymbol={<img src={ratingStarFull} className="icon" alt="ratingFull" />}
readonly/>
<span className="tr-reviews-value">{ `(${this.therapist.reviewCnt} reviews)` }</span>
</div>
{/* Phone */}
{this.renderContactInfo()}
</div>
</div>
<ReactTooltip type="info" place="right"/>
</li>

Try moving the flag row to the left column:
// Add a new div with the class name "left-col"
<div className="left-col">
<div className="tc-image-container">
<img src={this.getAvatarUrl(this.therapist)} alt="therapist-avatar" />
</div>
// Move the flags-row div from its original place to here
<div className="flags-row">
{this.renderVerifiedFlag()}
{this.renderInsuranceFlag()}
</div>
</div>
<div className="tc-info-container">
...the rest of your DOM remains unchanged
</div>
// Give .left-col div the same width as the current image-container.
& .left-col {
width: 130px;
}
You might need to fiddle with the CSS a bit. But the general idea is here.

Moving the verified provider text code directly under the img code will do the trick.
Might just have to adjust bottom margin for the img for spacing.

Related

set child element to be 100% width of parent

I have a main element which is divided into a grid of 3 columns.
in the middle column I am displaying some listings.
each listing is a div element and has a react bootstrap card inside it.
I am trying to get the card to span 100% of the parent but that doesn't seem to be working for me.
React component
<div className="backfill">
<Row key={Listing_Id}>
<Card style={{ cursor: 'pointer' }} border="light" className="text-center fullCard" >
<Card.Body>
<Card.Title className="Title">
{Listing_Name}
<hr />
<Button className="Button" variant="outline-success" onClick={() => props.handleLikeDisLike(Listing_Id, 'Listing_Likes', Listing_Location)}> <Twemoji options={options} text=":+1:" /></Button>
<Badge className="Badge" variant="light">{Listing_Likes}</Badge>
<Button className="Button" variant="outline-danger" onClick={() => props.handleLikeDisLike(Listing_Id, 'Listing_DisLikes', Listing_Location)}><Twemoji options={options} text=":-1:" /></Button>
<Badge className="Badge" variant="light">{Listing_DisLikes}</Badge>
<hr />
<Button className="Button" variant="outline-info" ><Twemoji text=":pushpin:" /></Button>
<Badge className="Badge" variant="light">{Listing_Location}</Badge>
</Card.Title>
<Card.Text className="Listing" onClick={() => handleClick(Listing_Id)} >
<hr />
{ListingBody}
<ModalLayout
Listing_Location={Listing_Location}
Listing_Likes={Listing_Likes}
Listing_DisLikes={Listing_DisLikes}
Listing_Name={Listing_Name}
Listing_Id={Listing_Id}
handleLikeDisLike={props.handleLikeDisLike}
handleClose={closeModal}
show={showModal} />
</Card.Text>
</Card.Body>
</Card>
</Row>
<br />
</div >
CSS for div and Card elements
.backfill {
background-color: aqua;
}
.fullCard {
width:'100%';
}
I currently end up with the UI looking like this. Please can you help me sort this out. I want to get the card to be 100% of its parent div.
Just had to remove the single quotes from the CSS
.fullCard {
width:'100%';
}
had to become
.fullCard {
width:100%;
}

Display Transfers Button at the far right corner

<div class="account-tile" qa-name="accountBlock">
<a
*ngIf="link"
class="account-detail-header"
[routerLink]="'/AccountDetails/' + account.index!"
>
<div qa-name="accountName" class="account-name">
{{ account.accountName }}
</div>
<div qa-name="accountNumber" class="account-number">
...{{ account.number | lastFour }}
</div>
<span>
<i class="gg-chevron-right"></i>
</span>
</a>
<div *ngIf="!link" class="account-detail-header">
<div qa-name="accountName" class="account-name">
{{ account.accountName }}
</div>
<div qa-name="accountNumber" class="account-number">
...{{ account.number | lastFour }}
</div>
</div>
<div class="available-balance-container">
<div class="flex">
<span class="negative-account" *ngIf="account.availableBalance! < 0"
>-</span
>
<span
[ngClass]="link ? 'format-dollar-link' : 'format-dollar-display'"
class="format-dollar"
>
$
</span>
<h2 qa-name="availableBalance">
{{ account.availableBalance | currency: '':'' | absolute }}
</h2>
<!--This is wheere the transfer button appears-->
<div class="parent=class">
<button class="button-right pull-right">Transfer</button>
</div>
</div>
<h3>Available Balance</h3>
</div>
</div>
I am trying to display a transfer button at the right corner to look like the picture above. How can I accomplish that? I tried creating a button and a class that pulls the button to the right. when I compile the code, the transfer button shows underneath the Account amount
You can add position: absolute to your transfer button.
.parent-class {
position: relative;
height: 100px;
border: 1px solid red;
}
.button-right {
position: absolute;
right: 10px;
}
<div class="parent-class">
<button class="button-right">Transfer</button>
</div>

Text moves slightly to left when a picture is placed at the right side Bootstrap 4

I'm trying to align everything perfectly but when I add an image to the last element in the row it moves to left. Examples below.
When the image is added to the last element in the row
When the image is not added to the the last element in the row
I'm using Bootstrap 4 with the latest ReactJS.
React/HTML
import React, { Component } from 'react';
class NavigationBar extends Component {
render() {
return (
<div>
{/* Navigation bar */}
<nav className="navbar navbar-expand-lg header">
{/* Wrap the code inside this div in a container */}
<div className="container">
{/* Navigation bar brand*/}
<a href="#" className="navbar-brand">
<img src="../../imgs/logo.png" className="header-brand" alt=""/>
</a>
{/* Pull the wrapped code to the right*/}
<div className="pull-right">
{/* Dropdown Menu */}
<div className="dropdown">
{/* Profile button to open multiple options */}
<button className="dropdown-toggle header-dropdown"
type="button"
data-toggle="dropdown"> Username
{/* Arrow down to show that it's a dropdown menu */}
</button>
{/* Dropdown Items */}
<ul className="dropdown-menu dropdown-menu-right">
<li>
<a className="dropdown-item" href="#">
<img className="dropdown-picto" src="../../imgs/settings.png" alt=""/>
Instellingen
</a>
</li>
<div className="dropdown-divider" />
<li>
<a className="dropdown-item" href="#">
<img className="dropdown-picto" src="../../imgs/support.png" alt=""/>
Support
</a>
</li>
<div className="dropdown-divider" />
<li>
<a className="dropdown-item" href="#">
<img className="dropdown-picto" src="../../imgs/logout.png" alt=""/>
Log uit
</a>
</li>
</ul>
</div>
</div>
</div>
</nav>
</div>
);
} }export default NavigationBar;
CSS
.hub {
background-color: #fff;
color: #666666;
height: 4.5rem;
border-bottom: solid #e2e2e2 0.5px;
margin-bottom: 3rem;
}
.hub-item {
color: #666666;
text-decoration: none;
margin-left: 5px;
font-size: 16px;
}
.hub-picto {
height: 35%;
width: 15%;
padding-right: 5px;
}
try removing margin-left of hub-item in css file

Moving buttons to the bottom of an element

I am using Material UI to create cards that take an argument Actions which is a list of buttons.
The length of the Card is relative to the text I enter, but all Cards will be the same height.
I am very new to CSS and still wrapping my mind around position: fixed, relative, absolute.
This is the code that renders the Card:
export function ViewCurrentPitches2(props) {
const actions = [
<FlatButton
label="Cancel"
primary={true}
onClick={props.closeEditPitch}
/>,
<FlatButton
label="Save"
primary={true}
keyboardFocused={true}
onClick={props.savePitchBeingEdited}
/>,
];
return (
props.state.savedPitches.map((pitch, i) => {
return(
<Card key={pitch.id} className = 'form-margin card-width' zDepth={3}>
<CardText>{pitch.subject} </CardText>
<CardText className='card'>{pitch.pitch}</CardText>
<CardActions>
<FlatButton label="Edit" onClick={(e) => {props.toggleEdit(e, pitch); console.log(props.state.pitchBeingEdited)}}/>
<Dialog
className="dialogBox"
title="Test"
modal={false}
actions={actions}
open={props.state.editPitch}
contentStyle={customContentStyle}
autoScrollBodyContent={true}
>
<TextFieldExampleCustomize currentValue = {props.state.pitchBeingEdited} updateNewPitch = {props.updatePitchBeingEdited} />
</Dialog>
<FlatButton label="Delete" onClick={(e) => {props.deletePitch(e, pitch)}} />
</CardActions>
</Card>
)
})
)
}
<div className='card-parent'>
<ViewCurrentPitches2
state= {this.state}
deletePitch = {this.deletePitch}
handleSave={this.dialogBoxSave}
toggleEdit = {this.toggleEdit}
closeEditPitch = {this.closeEditPitch}
updatePitchBeingEdited = {this.updatePitchBeingEdited}
savePitchBeingEdited = {this.savePitchBeingEdited}
/>
</div>
This is what it looks like:
Can anyone explain to me
1.) When I'm adding in the CSS position: relative | fixed | absolute ...etc what is happening? I assign that to the child correct?
2.) If I want to move the buttons to the bottom of the Card, Card is the parent and I put the styling on the button? How would I go about doing this?
Generally speaking, you would assign relative to the parent and absolute to the child. The child is being positioned absolutely, relative to the parent.
Refer to full documentation for more details.
.card{
display:inline-block;
width:200px;
height: 100px;
border: 1px solid red;
position: relative;
}
.buttons{
position: absolute;
bottom: 0;
border: 1px solid blue;
width: 100%;
}
<div class="parent">
<div class="card">
<div class="buttons">
<button>Edit</button>
<button>Delete</button>
</div>
</div>
<div class="card">
<div class="buttons">
<button>Edit</button>
<button>Delete</button>
</div>
</div>
<div class="card">
<div class="buttons">
<button>Edit</button>
<button>Delete</button>
</div>
</div>
<div>

Using Tabs within Tab isn't working - Material Design Lite

I want to make use of tabs layout within tabs layout. I am using Material Design lite which has already made classes for tabs therefore I am trying to make use of the same.
The Tab Number 1 - Horizontal Tab is working individually without any problem.
The Tab Number 2 - Vertical Tab is working individually without any problem.
Now I tried to use tab number 2 within tab number 1. Tab number one's working remain the same but tab number 2 isn't working.
Please take a look at this Plunker link : https://plnkr.co/edit/LVPexb9akrRR2AoPGEGO?p=preview
Code - HTML
<!DOCTYPE html>
<html>
<head>
<link data-require="material-design-lite#1.1.1" data-semver="1.1.1" rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link data-require="material-design-lite#1.1.1" data-semver="1.1.1" rel="stylesheet" href="https://code.getmdl.io/1.1.1/material.indigo-pink.min.css" />
<script data-require="material-design-lite#1.1.1" data-semver="1.1.1" src="https://code.getmdl.io/1.1.1/material.min.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body>
<h4>Combined Tab 2 within Tab 1</h4>
<div class="mdl-tabs mdl-js-tabs">
<div class="mdl-tabs__tab-bar">
Tab One
Tab Two
Tab Three
</div>
<div class="mdl-tabs__panel is-active" id="tab1">
<div class="mdl-tabs vertical-mdl-tabs mdl-js-tabs mdl-js-ripple-effect">
<div class="mdl-grid mdl-grid--no-spacing">
<div class="mdl-cell mdl-cell--2-col">
<div class="mdl-tabs__tab-bar">
<a href="#tab1-panel" class="mdl-tabs__tab is-active">
<span class="hollow-circle"></span> General
</a>
<a href="#tab2-panel" class="mdl-tabs__tab">
<span class="hollow-circle"></span> Bank
</a>
<a href="#tab3-panel" class="mdl-tabs__tab">
<span class="hollow-circle"></span> Password
</a>
</div>
</div>
<div class="mdl-cell mdl-cell--10-col">
<div class="mdl-tabs__panel is-active" id="tab1-panel">
Content 1
</div>
<div class="mdl-tabs__panel" id="tab2-panel">
Content 2
</div>
<div class="mdl-tabs__panel" id="tab3-panel">
Content 3
</div>
</div>
</div>
</div>
</div>
<div class="mdl-tabs__panel" id="tab2">
<p>Second tab's content.</p>
</div>
<div class="mdl-tabs__panel" id="tab3">
<p>Third tab's content.</p>
</div>
</div>
<h4>Tab 1 Individual</h4>
<div class="mdl-tabs mdl-js-tabs">
<div class="mdl-tabs__tab-bar">
Tab One
Tab Two
Tab Three
</div>
<div class="mdl-tabs__panel is-active" id="tab1">
<p>First tab's content.</p>
</div>
<div class="mdl-tabs__panel" id="tab2">
<p>Second tab's content.</p>
</div>
<div class="mdl-tabs__panel" id="tab3">
<p>Third tab's content.</p>
</div>
</div>
<h4>Tab 2 Individual</h4>
<div class="mdl-tabs vertical-mdl-tabs mdl-js-tabs mdl-js-ripple-effect">
<div class="mdl-grid mdl-grid--no-spacing">
<div class="mdl-cell mdl-cell--2-col">
<div class="mdl-tabs__tab-bar">
<a href="#tab1-panel" class="mdl-tabs__tab is-active">
<span class="hollow-circle"></span> General
</a>
<a href="#tab2-panel" class="mdl-tabs__tab">
<span class="hollow-circle"></span> Bank
</a>
<a href="#tab3-panel" class="mdl-tabs__tab">
<span class="hollow-circle"></span> Password
</a>
</div>
</div>
<div class="mdl-cell mdl-cell--10-col">
<div class="mdl-tabs__panel is-active" id="tab1-panel">
Content 1
</div>
<div class="mdl-tabs__panel" id="tab2-panel">
Content 2
</div>
<div class="mdl-tabs__panel" id="tab3-panel">
Content 3
</div>
</div>
</div>
</div>
</body>
</html>
Css
/*Vertical Tabs*/
.vertical-mdl-tabs {
margin-top: 30px;
}
.vertical-mdl-tabs .mdl-tabs__tab-bar {
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
padding-bottom: 35px;
height: inherit;
border-bottom: none;
border-right: 1px solid #d9d9d9;
}
.vertical-mdl-tabs .mdl-tabs__tab {
width: 100%;
height: 35px;
line-height: 35px;
box-sizing: border-box;
letter-spacing: 2px;
}
.vertical-mdl-tabs.mdl-tabs.is-upgraded a.mdl-tabs__tab.is-active {
border-right: 2px solid #EF5350;
}
.vertical-mdl-tabs.mdl-tabs.is-upgraded .mdl-tabs__tab.is-active:after {
content: inherit;
height: 0;
}
.vertical-mdl-tabs.mdl-tabs.is-upgraded .mdl-tabs__panel.is-active, .mdl-tabs__panel {
padding: 0 30px;
}
.vertical-mdl-tabs.mdl-tabs .mdl-tabs__tab {
text-align: left;
}
If I'm guessing right, you have taken the "vertical tab's code" from this article Vertical tabs in Material design lite. I have written that article, and as far as I can understand, your problem is not related to vertical tabs. You will face the same problem if you use horizontal tabs inside horizontal tabs too.
The problem might be occurring due to javscript code of mdl-tabs. Original developers might be using tabs parent container to find each tabs under that container and binding click events to it. That is why creating problem. Unable to understand right now due to minification.
Solution: Instead of binding click event to child tabs under a parent. You need to change the code to find the "Closest" parent tab container based on the tab clicked and modify the child tabs based on the parent tab found.
Might be overwhelming, but that is what I can guess is happening.
I notice that nesting tabs is broken in MDL. When you select an inner tab all other tabs are deselected - including the outer tabs, so no tabs are selected on the outer tabs and the inner tabs vanish.
I found that If I add the inner tabs "programatically" using JS then this bug doesn't occur. When you do this you have to remember to upgrade the inner tabs with componentHandler.upgradeElement(myInnerTabs);