JSFiddle - React, Tailwind, and code Playground
CSS
main {
display: flex;
flex-direction: column;
}
.panel {
width: 75%;
display: flex;
padding: 0.5em;
margin: 0.2em 0 0.2em 0;
border: 1px solid #565656;
background-color: #efefef;
flex-direction: row;
align-items: flex-start;
}
.genres {
margin: 0.3em 0 0 0;
padding-left: 0;
list-style-type: none;
}
.panel div:first-child {
width: 100%;
}
.genre {
display: inline-flex;
margin-right: 0.4em;
}
.title {
font-weight: 600;
font-size: 1.1em;
}
.year {
text-align: right;
}
JavaScript
const data = [{ title: 'Mad Max: Fury Road', genre: ['Action & Adventure'], year: 2015 }, { title: 'Inside Out', genre: ['Animation', 'Kids & Family'], year: 2015 }, { title: 'Star Wars: Episode VII - The Force Awakens', genre: ['Action'], year: 2015 }];
function fillTemplate({ title, genre, year}) {
return `
<section class="panel">
<div class="left">
<div class="title">${title}</div>
<ul class="genres">
<li class="genre">${genre.join('</li><li class="genre">')}</li>
</ul>
</div>
<div class="year">${year}</div>
</section>
`;
}
const html = data.map(obj => fillTemplate(obj));
document.querySelector('main').innerHTML = html.join('');