Skip to content

Commit

Permalink
feat(ui): use end adornment for quantity input
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyckahn committed Apr 6, 2024
1 parent e0a9b51 commit 7b99217
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
3 changes: 1 addition & 2 deletions src/components/Farmhand/Farmhand.sass
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,11 @@ body
padding: 16px

.MuiCardActions-root
flex-wrap: wrap

button
margin-bottom: 0.3em
margin-left: 0.25em
margin-right: 0.25em
margin-right: 1em

h1,
h2,
Expand Down
5 changes: 3 additions & 2 deletions src/components/Item/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'
import KeyboardArrowUp from '@mui/icons-material/KeyboardArrowUp'
import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown'
import Button from '@mui/material/Button'
import Box from '@mui/material/Box'
import Card from '@mui/material/Card'
import CardHeader from '@mui/material/CardHeader'
import CardContent from '@mui/material/CardContent'
Expand Down Expand Up @@ -340,7 +341,7 @@ export const Item = ({
</>
)}
{isSellView && (
<>
<Box display="flex" pr={0.5}>
<Button
{...{
className: 'sell',
Expand All @@ -361,7 +362,7 @@ export const Item = ({
value: sellQuantity,
}}
/>
</>
</Box>
)}
</CardActions>
</Card>
Expand Down
22 changes: 12 additions & 10 deletions src/components/QuantityInput/QuantityInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ const QuantityTextInput = ({

InputProps: {
inputComponent: QuantityNumberFormat,
endAdornment: (
<>
/{' '}
<AnimatedNumber
{...{
number: maxQuantity,
formatter: integerString,
animatedNumberSx: { pl: 1 },
}}
/>
</>
),
},
}}
/>
Expand Down Expand Up @@ -94,16 +106,6 @@ const QuantityInput = ({
<QuantityTextInput
{...{ handleSubmit, handleUpdateNumber, maxQuantity, value }}
/>
<span className="quantity">
/{' '}
<AnimatedNumber
{...{
number: maxQuantity,
formatter: integerString,
animatedNumberSx: { pl: 1 },
}}
/>
</span>
<div className="number-nudger-container">
<Fab
disabled={!value}
Expand Down
6 changes: 2 additions & 4 deletions src/components/QuantityInput/QuantityInput.sass
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@
line-height: 2.3em

.MuiInput-root
max-width: 75px
margin: 1px 0.25em 0

@media (max-width: #{$break-medium-phone})
margin: 0 0.25em 0 0.5em
max-width: 65px

input
text-align: right
Expand All @@ -25,11 +23,11 @@
display: flex
flex-direction: column
position: absolute
top: 0
top: 0.25em
right: 0

button
margin: 0.25em
margin: 0.25em .5em

svg
// Needed to override
Expand Down

0 comments on commit 7b99217

Please sign in to comment.