Skip to content

Commit

Permalink
fix: icon-buttons in table are too large
Browse files Browse the repository at this point in the history
  • Loading branch information
czabaj committed Jul 21, 2023
1 parent 2c406b8 commit b74d942
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 27 deletions.
1 change: 1 addition & 0 deletions src/components/ButtonMenu/ButtonMenu.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
top: anchor(bottom);
right: anchor(right);
padding: 0;
padding-block: 0.5rem;
}
.popover ul {
list-style: none;
Expand Down
13 changes: 10 additions & 3 deletions src/components/InputDonors/InputDonors.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
border-collapse: collapse;
border-spacing: 0;
}

.root table :where(td, th) {
text-align: left;
}
.root table :where(td, th):nth-child(2) {
text-align: right;
.root table input[type="number"] {
inline-size: 8ch;
}
.root tbody th {
font-weight: var(--font-weight-regular);
}

.root legend {
font-weight: var(--font-weight-bold);
font-size: var(--font-size-18);
}
43 changes: 24 additions & 19 deletions src/components/InputDonors/InputDonors.res
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ let make = (~errorMessage=?, ~legendSlot=?, ~persons, ~value, ~onChange) => {
</td>
<td>
<button
className={`${Styles.button.base} ${Styles.button.iconOnly}`}
className={`${Styles.button.base} ${Styles.button.iconOnly} ${Styles.button.sizeExtraSmall}`}
onClick={_ => {
let newValue = value->Dict.copy
newValue->Dict.delete(name)
Expand All @@ -65,32 +65,37 @@ let make = (~errorMessage=?, ~legendSlot=?, ~persons, ~value, ~onChange) => {
})
->React.array}
</tbody>
<tbody>
<tr>
<td>
<select
disabled={availableNames->Array.length === 0}
onChange={event => {
let person = ReactEvent.Form.target(event)["value"]
if person !== "" {
let newValue = value->Dict.copy
newValue->Dict.set(person, 0)
onChange(newValue)
}
}}
value="">
<option disabled={true} value=""> {React.string("Přidat vkladatele")} </option>
{availableNames
->Array.map(name => <option key={name} value={name}> {React.string(name)} </option>)
->React.array}
</select>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th scope="row"> {React.string("Celkem")} </th>
<td>
<td colSpan=2>
<FormattedCurrency value={amountsSum} />
</td>
<td />
</tr>
</tfoot>
</table>
<select
disabled={availableNames->Array.length === 0}
onChange={event => {
let person = ReactEvent.Form.target(event)["value"]
if person !== "" {
let newValue = value->Dict.copy
newValue->Dict.set(person, 0)
onChange(newValue)
}
}}
value="">
<option disabled={true} value=""> {React.string("Přidat vkladatele")} </option>
{availableNames
->Array.map(name => <option key={name} value={name}> {React.string(name)} </option>)
->React.array}
</select>
{switch errorMessage {
| None => React.null
| Some(errorMessage) => <InputWrapper.ErrorMessage message={errorMessage} />
Expand Down
3 changes: 2 additions & 1 deletion src/components/InputDonors/InputDonors.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ const Wrapper = (args: any) => {

export const Base: StoryObj = {
args: {
value: {},
legendSlot: "Vkladatelé sudu",
value: { Petr: 10000 },
persons: ["Petr", "Jana", "Karel"],
},
render: Wrapper,
Expand Down
2 changes: 1 addition & 1 deletion src/components/TableConsumptions/TableConsumptions.res
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let make = (
</td>
<td>
<button
className={`${Styles.button.base}`}
className={`${Styles.button.base} ${Styles.button.sizeExtraSmall}`}
onClick={_ => onDeleteConsumption(consumption)}
type_="button">
{React.string("🗑️ Smáznout")}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Place/DrinkDialog.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.root > :global(.dialogWindow) {
--dialog-padding-inline: 3rem;
--dialog-padding-inline: clamp(1rem, 4vw, 3rem);
inline-size: 60ch;
}
.root:modal {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/PlaceSetting/KegDetail.res
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ let make = (
{keg.depletedAt !== Null.null
? React.null
: <button
className={`${Styles.button.base}`}
className={`${Styles.button.base} ${Styles.button.sizeExtraSmall}`}
onClick={_ => onDeleteConsumption(timestampStr)}
type_="button">
{React.string("🗑️ Smáznout")}
Expand Down
1 change: 1 addition & 0 deletions src/styles/components/Styles.res
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type buttonClasses = {
sizeLarge: string,
sizeMedium: string,
sizeSmall: string,
sizeExtraSmall: string,
variantDanger: string,
variantPrimary: string,
variantStealth: string,
Expand Down
3 changes: 2 additions & 1 deletion src/styles/components/button.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@

.sizeExtraSmall {
--_padding-inline: 0.5rem;
--_block-size: 1.25rem;
--_block-size: 1rem;
--_font-weight: var(--font-weight-1);
font-size: var(--font-size-14);
}

.flat {
Expand Down

0 comments on commit b74d942

Please sign in to comment.