Deck listing frontend layout

This commit is contained in:
jorenchik
2024-08-04 18:05:48 +03:00
parent c925df3fc4
commit bb4868fa98
3 changed files with 102 additions and 52 deletions

View File

@@ -6,7 +6,55 @@
<title>mdemory-app</title>
</head>
<body>
<div id="app"></div>
<div id="app">
<div class="main-layout">
<div>
<h3>Memorybase</h3>
<div class="deck-list">
<a href="#">
<div class="deck">
<span>&gt;</span>
<span>math</span>
</div>
</a>
<a href="#">
<div class="deck">
<span>&gt;</span>
<span>2nd_semester</span>
</div>
</a>
<a href="#">
<div class="deck">
python
</div>
</a>
<a href="#">
<div class="deck">
combinatorics
</div>
</a>
<a href="#">
<div class="deck">
cpp
</div>
</a>
</div>
</div>
<div>
<h2>countries: Flashcards</h2>
<div class="deck-listing">
<div class="flashcard">
<span>&gt;</span>
<span>What is the capital of Latvia?</span>
</div>
<div class="flashcard">
<span>&gt;</span>
<span>What is the capital of Lithuania?</span>
</div>
</div>
</div>
</div>
</div>
<script src="./src/main.ts" type="module"></script>
</body>
</html>

View File

@@ -1,54 +1,62 @@
#logo {
display: block;
width: 50%;
height: 50%;
margin: auto;
padding: 10% 0 0;
background-position: center;
background-repeat: no-repeat;
background-size: 100% 100%;
background-origin: content-box;
.main-layout {
display: grid;
grid-template-columns: .35fr 1fr; /* Creates 3 equal columns */
height: 100%;
}
.result {
height: 20px;
line-height: 20px;
margin: 1.5rem auto;
.main-layout > div:nth-child(1) {
/*background: white;*/
border-right: 1px solid gray;
}
.input-box .btn {
width: 60px;
height: 30px;
line-height: 30px;
border-radius: 3px;
border: none;
margin: 0 0 0 20px;
padding: 0 8px;
cursor: pointer;
.main-layout .deck-list {
padding: 1rem;
display: flex;
flex-direction: column;
/*gap: .5rem;*/
}
.input-box .btn:hover {
background-image: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%);
color: #333333;
a {
color: unset;
text-decoration: unset;
}
.input-box .input {
border: none;
border-radius: 3px;
outline: none;
height: 30px;
line-height: 30px;
padding: 0 10px;
background-color: rgba(240, 240, 240, 1);
-webkit-font-smoothing: antialiased;
.main-layout .deck {
border: 1px solid gray;
border-top: none;
display: flex;
align-items: center;
height: 30px;
padding-left: .5rem;
font-size: .8rem;
gap: 10px;
}
.input-box .input:hover {
border: none;
background-color: rgba(255, 255, 255, 1);
.main-layout .deck:nth-child(1) {
border-top: 1px solid gray;
}
h1, h2, h3, h4 {
font-size: 1.1rem;
}
.deck-listing {
display: flex;
flex-direction: column;
padding: 1rem;
gap: 1rem;
}
.deck-listing .flashcard {
display: flex;
align-items: center;
border: 1px solid white;
height: 80px;
border-radius: .3rem;
}
.deck-listing .flashcard > * {
margin-left: 15px;
}
.input-box .input:focus {
border: none;
background-color: rgba(255, 255, 255, 1);
}

View File

@@ -27,15 +27,9 @@ window.greet = function () {
}
};
document.querySelector('#app')!.innerHTML = `
<img id="logo" class="logo">
<div class="result" id="result">Please enter your name below 👇</div>
<div class="input-box" id="input">
<input class="input" id="name" type="text" autocomplete="off" />
<button class="btn" onclick="greet()">Greet</button>
</div>
</div>
`;
//document.querySelector('#app')!.innerHTML = `
//`;
(document.getElementById('logo') as HTMLImageElement).src = logo;
let nameElement = (document.getElementById("name") as HTMLInputElement);