Skip to content

Commit

Permalink
Merge patch commit
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Apr 7, 2024
2 parents e156678 + 131d947 commit 970726b
Show file tree
Hide file tree
Showing 9 changed files with 1,918 additions and 1,932 deletions.
3,784 changes: 1,888 additions & 1,896 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jeremyckahn/farmhand",
"version": "1.18.10",
"version": "1.18.11",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -56,7 +56,7 @@
"browserslist": "^4.21.9",
"cross-env": "^7.0.2",
"electron": "^22.1.0",
"electron-builder": "^23.1.0",
"electron-builder": "^24.13.3",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.12.1",
"eslint": "^7.13.0",
Expand Down
3 changes: 2 additions & 1 deletion src/components/AnimatedNumber/AnimatedNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { func, number } from 'prop-types'

import './AnimatedNumber.sass'

const defaultFormatter = number => `${number}`
const defaultFormatter = (/** @type {number} */ number) => `${number}`

const AnimatedNumber = ({ number, formatter = defaultFormatter }) => {
const [displayedNumber, setDisplayedNumber] = useState(number)
Expand Down Expand Up @@ -42,6 +42,7 @@ const AnimatedNumber = ({ number, formatter = defaultFormatter }) => {
}
}
}, [currentTweenable, number, previousNumber])

return <span className="AnimatedNumber">{formatter(displayedNumber)}</span>
}

Expand Down
8 changes: 8 additions & 0 deletions src/components/Elements/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import styled from '@mui/material/styles/styled'

// NOTE: Elements in this file are intended to make standard DOM elements easy
// to style with MUI's sx prop.
// @see: https://mui.com/system/styled/
// @see: https://mui.com/system/getting-started/the-sx-prop/

export const Span = styled('span')({})
8 changes: 0 additions & 8 deletions src/components/Farmhand/Farmhand.sass
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,6 @@ body
// Overrides an unhelpful MUI default
padding: 16px

.MuiCardActions-root
flex-wrap: wrap

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

h1,
h2,
h3,
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">
<Button
{...{
className: 'sell',
Expand All @@ -361,7 +362,7 @@ export const Item = ({
value: sellQuantity,
}}
/>
</>
</Box>
)}
</CardActions>
</Card>
Expand Down
21 changes: 13 additions & 8 deletions src/components/QuantityInput/QuantityInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown'
import NumberFormat from 'react-number-format'
import TextField from '@mui/material/TextField'

import AnimatedNumber from '../AnimatedNumber'

import { integerString } from '../../utils'
import AnimatedNumber from '../AnimatedNumber'
import { Span } from '../Elements'

import './QuantityInput.sass'

Expand Down Expand Up @@ -61,6 +61,17 @@ const QuantityTextInput = ({

InputProps: {
inputComponent: QuantityNumberFormat,
endAdornment: (
<>
<Span sx={{ px: 1 }}>/</Span>
<AnimatedNumber
{...{
number: maxQuantity,
formatter: integerString,
}}
/>
</>
),
},
}}
/>
Expand Down Expand Up @@ -94,12 +105,6 @@ const QuantityInput = ({
<QuantityTextInput
{...{ handleSubmit, handleUpdateNumber, maxQuantity, value }}
/>
<span className="quantity">
/{' '}
<AnimatedNumber
{...{ number: maxQuantity, formatter: integerString }}
/>
</span>
<div className="number-nudger-container">
<Fab
disabled={!value}
Expand Down
14 changes: 2 additions & 12 deletions src/components/QuantityInput/QuantityInput.sass
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
@import ../../styles/variables.sass

.QuantityInput
// Needed to override the .MuiCardActions-root to work well with the MUI card
// action item spacing.
.MuiCardActions-root &
button
margin-left: 1em

.quantity
line-height: 2.8em

.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 +15,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
3 changes: 0 additions & 3 deletions src/mui-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ export default createTheme({
styleOverrides: {
root: {
margin: '1rem 0',
'& input': {
padding: '0.5rem',
},
},
},
},
Expand Down

0 comments on commit 970726b

Please sign in to comment.