fix: changed back table style to side scrolling on mobile

pull/1/head
Antonio De Lucreziis 2 years ago
parent 42e9a05818
commit dda2e2c36f

@ -123,23 +123,25 @@ export const AdminPage = ({}) => {
<> <>
<hr /> <hr />
<div class="subtitle">Controlli speciali solo per Admin</div> <div class="subtitle">Controlli speciali solo per Admin</div>
<div class="users-table" style={{ '--cols': 4 }}> <div class="scrollable">
<div class="cell header">Username Ateneo</div> <div class="users-table" style={{ '--cols': 4 }}>
<div class="cell header">Nome Utente</div> <div class="cell header">Username Ateneo</div>
<div class="cell header">Ruolo</div> <div class="cell header">Nome Utente</div>
<div class="cell header last-col">Azioni</div> <div class="cell header">Ruolo</div>
<div class="cell header last-col">Azioni</div>
{users.map(user => (
<> {users.map(user => (
<div class="cell mono">{user.id}</div> <>
<div class="cell">{user.fullName}</div> <div class="cell mono">{user.id}</div>
<div class="cell">{user.role}</div> <div class="cell">{user.fullName}</div>
<div class="cell last-col"> <div class="cell">{user.role}</div>
<button>Boh 1</button> <div class="cell last-col">
<button>Boh 2</button> <button>Boh 1</button>
</div> <button>Boh 2</button>
</> </div>
))} </>
))}
</div>
</div> </div>
<div class="form"> <div class="form">
<div class="fill subtitle mono">su $USER</div> <div class="fill subtitle mono">su $USER</div>

@ -24,6 +24,8 @@ body {
font-weight: 300; font-weight: 300;
font-size: 18px; font-size: 18px;
color: #222;
line-height: 1; line-height: 1;
} }
@ -385,135 +387,42 @@ main.page-problem {
} }
main.page-scores { main.page-scores {
.scrollable { .table {
display: flex; grid-template-columns: repeat(3, auto);
overflow: auto;
max-width: 100%; .icon {
padding: 1rem; cursor: pointer;
display: grid;
place-content: center;
}
.table { .cell {
grid-template-columns: repeat(3, auto); padding: 1rem 2rem 1rem 1rem;
.icon { &.header {
cursor: pointer; font-weight: 400;
display: grid; font-size: 22px;
place-content: center;
}
.cell { padding-right: 0.5rem;
padding: 1rem 2rem 1rem 1rem;
&.header { background: #f0f0f0;
font-weight: 400;
font-size: 22px;
padding-right: 0.5rem; display: flex;
gap: 1rem;
background: #f0f0f0; align-items: center;
text-align: center;
justify-content: space-between;
}
display: flex; &:nth-child(3) {
gap: 1rem; border-top-right-radius: 0.5rem;
}
align-items: center; &:nth-last-child(3) {
text-align: center; border-bottom-left-radius: 0.5rem;
justify-content: space-between;
}
} }
} }
// .table {
// display: grid;
// grid-template-columns: auto auto auto;
// box-shadow: -2px 4px 6px 1px #00000018, 0 0 4px 0px #00000010;
// // border: 1px solid #ddd;
// border-radius: 0.5rem;
// background: #ffffff;
// user-select: none;
// position: relative;
// .cell {
// padding: 1rem 2rem;
// gap: 0.5rem;
// border-left: 1px solid #ddd;
// border-top: 1px solid #ddd;
// &:nth-child(3n + 3) {
// border-right: 1px solid #ddd;
// }
// &:nth-last-child(1),
// &:nth-last-child(2),
// &:nth-last-child(3) {
// border-bottom: 1px solid #ddd;
// }
// &:first-child {
// border-top-left-radius: 0.5rem;
// }
// &:nth-child(3) {
// border-top-right-radius: 0.5rem;
// }
// &:nth-last-child(3) {
// border-bottom-left-radius: 0.5rem;
// }
// &:last-child {
// border-bottom-right-radius: 0.5rem;
// }
// &:not(.header) {
// user-select: text;
// &:nth-child(3n + 1) {
// text-align: left;
// }
// &:nth-child(3n + 2),
// &:nth-child(3n + 3) {
// text-align: center;
// }
// &:nth-child(3n + 3) {
// &::after {
// content: '';
// position: absolute;
// left: 0;
// right: 0;
// height: 3rem;
// transform: translate(0, -1rem);
// pointer-events: none;
// background: transparent;
// }
// &:hover::after {
// background: #00000006;
// }
// }
// &:hover {
// &:nth-child(3n + 1) + .cell + .cell::after {
// background: #00000006;
// }
// &:nth-child(3n + 2) + .cell::after {
// background: #00000006;
// }
// }
// }
// }
// }
} }
} }
@ -521,6 +430,14 @@ main.page-scores {
// Components // Components
// //
.scrollable {
display: flex;
overflow: auto;
max-width: 100%;
padding: 1rem;
}
.table { .table {
display: grid; display: grid;
@ -533,11 +450,11 @@ main.page-scores {
user-select: none; user-select: none;
overflow: hidden;
.cell { .cell {
padding: 0.75rem; padding: 0.75rem;
white-space: nowrap;
border-right: 1px solid #ddd; border-right: 1px solid #ddd;
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
@ -547,6 +464,12 @@ main.page-scores {
align-items: center; align-items: center;
justify-content: start; justify-content: start;
&:first-child {
border-top-left-radius: 0.5rem;
}
&:last-child {
border-top-left-radius: 0.5rem;
}
&.last-col { &.last-col {
border-right: none; border-right: none;
} }
@ -574,27 +497,12 @@ main.page-scores {
} }
@media screen and (max-width: $device-s-width), (pointer: coarse) { @media screen and (max-width: $device-s-width), (pointer: coarse) {
display: flex;
flex-direction: column;
width: 100%;
.cell { .cell {
padding: 0.5rem 0.75rem; padding: 0.5rem;
gap: 0.5rem;
border-bottom: 1px dashed #ddd;
border-right: none;
&.last-row {
border-bottom: 1px dashed #ddd;
}
&.last-col {
border-bottom: 1px solid #bbb;
}
&.last-row.last-col { &.header {
border-bottom: none; padding: 0.75rem 0.5rem;
} }
} }
} }
@ -907,8 +815,14 @@ main.page-admin {
grid-template-columns: auto 1fr auto auto; grid-template-columns: auto 1fr auto auto;
width: 100%; .cell {
max-width: 80ch; &:nth-child(4) {
border-top-right-radius: 0.5rem;
}
&:nth-last-child(4) {
border-bottom-left-radius: 0.5rem;
}
}
} }
} }

Loading…
Cancel
Save