Constrain tables/grids to fix in viewwidth

This commit is contained in:
Tanguy Gérôme 2026-01-06 01:01:17 +02:00
parent 7d3ca6c2c6
commit 3d0e9206cd
Signed by: tanguy
GPG key ID: 10B2947233740B88
2 changed files with 44 additions and 32 deletions

View file

@ -329,7 +329,8 @@ function Home() {
<button onClick={openDialog.bind(null, addMethodDialogId)}> <button onClick={openDialog.bind(null, addMethodDialogId)}>
Add method Add method
</button> </button>
<table className='methods'> <div className='methods'>
<table>
<tbody> <tbody>
{methods?.map((method: any) => { {methods?.map((method: any) => {
const coffeeFound = coffees.find((coffee: any) => coffee.id === method.coffee_id) const coffeeFound = coffees.find((coffee: any) => coffee.id === method.coffee_id)
@ -353,6 +354,7 @@ function Home() {
})} })}
</tbody> </tbody>
</table> </table>
</div>
<div className="row randomizerButtons"> <div className="row randomizerButtons">
<button onClick={() => { <button onClick={() => {
setRandomMethodId(undefined) setRandomMethodId(undefined)

View file

@ -78,6 +78,7 @@ button:focus-visible {
padding: 0; padding: 0;
min-height: 100vh; min-height: 100vh;
min-width: 100vw; min-width: 100vw;
max-width: 100vw;
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
@ -98,6 +99,7 @@ nav h1 {
} }
main { main {
max-width: 100vw;
flex-grow: 1; flex-grow: 1;
align-self: stretch; align-self: stretch;
@ -119,29 +121,31 @@ main {
} }
.mixOptions { .mixOptions {
max-width: 95vw;
padding: 4px;
overflow: auto;
display: grid; display: grid;
grid-gap: 8px; grid-gap: 8px;
grid-template-columns: repeat(auto-fit, 300px); grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
grid-auto-flow: column; grid-auto-flow: column;
} }
.coffees, .grinders, .brewers { .coffees, .grinders, .brewers {
/* display: grid; */
/* grid-template-columns: subgrid; */
width: 100%; width: 100%;
max-width: 300px; max-width: 300px;
justify-self: center;
} }
.coffees { .coffees {
grid-column: 1; grid-column-start: 1;
} }
.grinders { .grinders {
grid-column: 2; grid-column-start: 2;
} }
.brewers { .brewers {
grid-column: 3; grid-column-start: 3;
} }
button.coffees, button.grinders, button.brewers { button.coffees, button.grinders, button.brewers {
@ -179,11 +183,17 @@ p.coffees, p.grinders, p.brewers {
.addSomethingDialog { .addSomethingDialog {
} }
table.methods { .methods {
max-width: 95vw;
padding: 4px;
overflow: auto;
}
.methods table {
border-collapse: collapse; border-collapse: collapse;
} }
table.methods td { .methods table td {
outline: #777777 1px solid; outline: #777777 1px solid;
padding: 2px 8px; padding: 2px 8px;
} }