Skip to content

Instantly share code, notes, and snippets.

@GiacomoManzoli
Created January 26, 2019 10:40
Show Gist options
  • Select an option

  • Save GiacomoManzoli/4598af307ffccad88d0377f1701a927f to your computer and use it in GitHub Desktop.

Select an option

Save GiacomoManzoli/4598af307ffccad88d0377f1701a927f to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link href="https://fonts.googleapis.com/css?family=Lato:100,100i,300,300i,400,400i,700,700i,900,900i" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/"
crossorigin="anonymous">
<style>
html {width: 100%;
height: 100%;
font-family:'Lato', sans-serif;
font-weight: 300;
}
body {
background-color: #e6e6e6;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.container {
width: 320px;
height: 568px;
background-color: #fafafa;
}
.my-list {
list-style-type: none;
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
.my-list li {
background: #f0f0f0;
display: flex;
max-width: 100%;
align-items: stretch;
height: 64px;
border-bottom: 1px solid #c6c6c6;
padding: 10px;
}
.row {
flex: 1;
flex-basis: content;
min-width: 0;
display: flex;
align-items: center;
}
.col {
display: flex;
flex-direction: column;
overflow: hidden;
}
.col1 {
flex: 1;
}
.col2 {
width: 32px;
justify-content: center;
align-items: center;
}
.icon {
width: 16px;
height: 16px;
display: flex;
align-items: center;
justify-content: center;
/* background-color: red; */
}
.giorno, .ora {
font-weight: 400;
font-size: 18px;
}
.ora {
margin-left: 10px;
}
.descrizione {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
min-width: 0;
font-size: 16px;
}
</style>
</head>
<body>
<div class="container">
<ul id="list" class="my-list">
</ul>
</div>
<script type="text/javascript">
let calendario = [
{
giorno: "Venerdì",
ora: "21:30 -> 22:30",
descrizione: "Appuntamento 1"
}, {
giorno: "Domenica",
ora: "21:30 -> 23:30",
descrizione: "Appuntamento 2"
}, {
giorno: "Giovedì",
ora: "21:30 -> 22:30",
descrizione: "Appuntamento 3 sdfsadfsdafdsffhsdajkhfsdjakhf"
},
]
let ul = document.getElementById("list");
calendario.forEach(app => {
let li = document.createElement("li");
li.innerHTML = `
<div class="col col1">
<div class="row"><span class="giorno">${app.giorno}</span><span class="ora">${app.ora}</span></div>
<div class="row"><span class="descrizione">${app.descrizione}</span></div>
</div>
<div class="col col2">
<span class="icon"><i class="fas fa-angle-right"></i></span>
</div>`;
ul.appendChild(li);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment