A little React and Flexbox thing.
Part of my 'Daily UI to Dev' stuff. Design from Dribbble: https://dribbble.com/shots/2336027-Email-Receipt-Day-017-dailyui
A Pen by Francis Lorenz Taberdo on CodePen.
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"> | |
<script src="https://use.fontawesome.com/f5ea91e308.js"></script> | |
<div class="container"> | |
<a href="https://dribbble.com/shots/2336027-Email-Receipt-Day-017-dailyui" target="_blank" class="view-design">View design on <i class="fa fa-dribbble"></i></a> | |
<div id="app"></div> | |
<div class="circle"></div> | |
</div> |
A little React and Flexbox thing.
Part of my 'Daily UI to Dev' stuff. Design from Dribbble: https://dribbble.com/shots/2336027-Email-Receipt-Day-017-dailyui
A Pen by Francis Lorenz Taberdo on CodePen.
//Data | |
const BreakDownContent = [ | |
{ | |
"text" : "Amount:", | |
"main" : "$20.00 USD", | |
"icon" : "fa fa-money" | |
}, | |
{ | |
"text" : "Date:", | |
"main" : "Nov 5", | |
"icon" : "fa fa-calendar" | |
}, | |
{ | |
"text" : "Issuer:", | |
"main" : "Dribbble", | |
"icon" : "fa fa-star-o" | |
}, | |
{ | |
"text" : "Confirmation No:", | |
"main" : "878NJDBW8Y9", | |
"icon" : "fa fa-list-alt" | |
} | |
] | |
// App | |
class Card extends React.Component { | |
constructor() { | |
super(); | |
this.state = { | |
breakdown : {} | |
} | |
} | |
componentWillMount() { | |
this.setState({ | |
breakdown: BreakDownContent | |
}); | |
} | |
render() { | |
return <div className="card"> | |
<div className="card-breakdown"> | |
<div className="card-breakdown--header"> | |
<p>Reciept for</p> | |
<h2>Dribbble</h2> | |
</div> | |
<ul className="card-breakdown--list"> | |
{ | |
Object | |
.keys(this.state.breakdown) | |
.map(key => <BreakDownEntry key={key} index={key} details={this.state.breakdown[key]}/>) | |
} | |
</ul> | |
</div> | |
<Overview product="Dribbble Pro Account (1 year)" merchant={'Dribbble'} merchantEmail={'[email protected]'} name={'Jamie'} value={'$20.00 USD'} invoiceId={'108165'}/> | |
</div> | |
} | |
} | |
//@TODO Get state into here | |
class Breakdown extends React.Component { | |
render() { | |
return <div className="card-breakdown"> | |
<div className="card-breakdown--header"> | |
<p>Reciept for</p> | |
<h2>Dribbble</h2> | |
</div> | |
<ul> | |
{ | |
Object | |
.keys(this.state.breakdown) | |
.map(key => <BreakDownEntry key={key} index={key} details={this.state.breakdown[key]}/>) | |
} | |
</ul> | |
</div> | |
} | |
} | |
class BreakDownEntry extends React.Component { | |
render() { | |
const { details } = this.props; | |
return <li> | |
<span className={details.icon}> | |
</span> | |
<div className="list-content"> | |
<p>{details.text} | |
<span className="list-bold">{details.main}</span> | |
</p> | |
</div> | |
</li> | |
} | |
} | |
class Overview extends React.Component { | |
render() { | |
return <div className="card-overview"> | |
<OverviewHeader logo={'https://s3-us-west-2.amazonaws.com/s.cdpn.io/553128/PayPal.svg'}/> | |
<OverviewBody {...this.props} /> | |
<OverviewFooter {...this.props} /> | |
</div> | |
} | |
} | |
class OverviewHeader extends React.Component { | |
render() { | |
return <div className="overview-header"> | |
<img className="logo" src={this.props.logo}/> | |
<div className="timestamp"> | |
<span>Oct 18, 2015</span> | |
<span>08:30:57 PDT</span> | |
</div> | |
<hr /> | |
</div> | |
} | |
} | |
class PurchaseOverview extends React.Component { | |
render() { | |
return <div className="purchase-overview"> | |
<h3>{this.props.product}</h3> | |
<p>Total: {this.props.value}</p> | |
</div> | |
} | |
} | |
class OverviewBody extends React.Component { | |
render() { | |
return <div className="overview-body"> | |
<PurchaseOverview {...this.props} /> | |
<div className="user-info"> | |
<p className="user-info-name"> Hello {this.props.name},</p> | |
<p className="user-info-text"> You sent a payment of <span>{this.props.value}</span> to {this.props.merchant}. (<a href="mailto: [email protected]">{this.props.merchantEmail}</a>)</p> | |
</div> | |
<div className="descriptor"> | |
<p>It may take a few moments for this transaction to appear in your account</p> | |
</div> | |
</div> | |
} | |
} | |
class OverviewFooter extends React.Component { | |
render() { | |
return <footer className="overview-footer"> | |
<span className="site"> | |
<a href="https://halvorson.digital/blog" target="_blank">www.paypal.com/help</a> | |
</span> | |
<span className="invoice-id"> | |
Invoice ID: {this.props.invoiceId} | |
</span> | |
</footer> | |
} | |
} | |
ReactDOM.render(<Card/>, document.getElementById('app')); |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react-dom.min.js"></script> |
/* Design Inspiration: https://dribbble.com/shots/2336027-Email-Receipt-Day-017-dailyui */ | |
$blue : #228af5; | |
$grey : #6e7882; | |
@mixin reset-list() { | |
text-indent: 0; | |
list-style: none; | |
padding: 0; | |
margin: 0; | |
&:before { | |
display: none; | |
content: ""; | |
} | |
} | |
body, html { | |
font-family: 'Roboto', sans-serif; | |
-webkit-font-smoothing: antialiased; | |
margin: 0; | |
} | |
a { | |
color: $blue; | |
text-decoration: none; | |
} | |
.view-design { | |
position:absolute; | |
top:30px; | |
left: 30px; | |
} | |
.container { | |
height: 760px; | |
overflow: hidden; | |
position:relative; | |
} | |
.circle { | |
display: none; | |
@media(min-width:768px){ | |
height: 1600px; | |
width: 1100px; | |
background-color: $blue; | |
position: absolute; | |
top: -400px; | |
right: -300px; | |
z-index: -1; | |
border-radius: 50%; | |
display:block; | |
} | |
} | |
.app { | |
} | |
.card { | |
display: flex; | |
flex-wrap: wrap; | |
margin: 100px auto; | |
width:830px; | |
box-shadow: 0px 0px 50px 10px rgba(0,0,0,.1); | |
vertical-align:top; | |
} | |
.card-breakdown { | |
background-color:$blue; | |
color:#fff; | |
width: 220px; | |
display:inline-block; | |
position:relative; | |
float:left; | |
padding: 40px 30px; | |
border-radius: 5px 0 0 5px; | |
.card-breakdown--list { | |
@include reset-list; | |
li { | |
padding: 25px 0; | |
border-bottom:1px solid rgba(255,255,255,.4); | |
&:last-of-type { | |
border-bottom: none; | |
} | |
} | |
.fa { | |
display: inline-block; | |
width:15%; | |
float:left; | |
} | |
.list-content { | |
width: 75%; | |
display:inline-block; | |
} | |
p { | |
font-weight:300; | |
font-size: 13px; | |
margin: 0; | |
.list-bold { | |
font-weight:600; | |
display:block; | |
font-size: 15px; | |
padding-top:5px; | |
} | |
} | |
} | |
} | |
.card-breakdown--header { | |
border-bottom:1px solid rgba(255,255,255,.4); | |
padding: 10px 0; | |
h2 { | |
margin: 0; | |
font-size: 22px; | |
padding-bottom: 15px; | |
} | |
p { | |
padding: 0 0 7px 0; | |
margin: 0; | |
} | |
} | |
.card-overview { | |
width: 490px; | |
display: inline-block; | |
border-radius: 0 5px 5px 0; | |
padding: 0 30px; | |
background-color: #fff; | |
hr { | |
border-top: 1px solid lighten($grey, 30%); | |
box-shadow: none; | |
} | |
.user-info { | |
padding-top: 15px; | |
} | |
} | |
.overview-header { | |
padding: 68px 0 20px 0; | |
} | |
.logo { | |
display: inline-block; | |
padding-bottom: 15px; | |
width:100px; | |
} | |
.timestamp { | |
display: inline-block; | |
float:right; | |
padding-top:5px; | |
span { | |
color: lighten($grey, 25%); | |
font-size: 15px; | |
font-family:inherit; | |
font-weight: 600; | |
&:first-of-type { | |
padding: 15px; | |
} | |
} | |
} | |
.descriptor { | |
width: 60%; | |
padding-top:20px; | |
p { | |
font-size: 13px; | |
color: $grey; | |
line-height: 1.5; | |
} | |
} | |
.overview-body { | |
color: $grey; | |
span { | |
color: #000; | |
} | |
} | |
.user-info-name { | |
font-weight:600; | |
font-size: 18px; | |
} | |
.user-info-text { | |
line-height:1.5; | |
font-weight: 500; | |
a { | |
color: $blue; | |
text-decoration: none; | |
} | |
} | |
.purchase-overview { | |
color: darken($grey, 12%); | |
} | |
.overview-footer { | |
padding: 30px 0; | |
margin-top: 30px; | |
border-top: 1px solid lighten($grey, 30%); | |
a { | |
font-size: 13px; | |
font-weight: 600; | |
} | |
.invoice-id { | |
float:right; | |
font-size: 13px; | |
color: $grey; | |
font-weight: 600; | |
} | |
} |