Hello-World-Software-Studios / calculator

Carpenter's tool for wall layout
0 stars 1 forks source link

Move numbers to the top of the file as `CONSTANT`s #26

Closed ecumene closed 3 years ago

ecumene commented 3 years ago

This one:

https://github.com/Hello-World-Software-Studios/calculator/blob/c4bec9890d695b722df2186732f6c1e14ee283cb/src/components/calculator.jsx#L10

Could come from the top of the file as a const CENTER_SPACING_IMPERIAL = 16. Just so it's a little more organized

JPM709 commented 3 years ago

something like:

const CENTER_SPACING_IMPERIAL = 16;
const CENTER_SPACING_METRIC = 406.4;

export default function Calculator() {
  const onCenterSpacing = isImperialUnit ? CENTER_SPACING_IMPERIAL : CENTER_SPACING_METRIC;
}
ecumene commented 3 years ago

Exactly!

JPM709 commented 3 years ago

alright, thats done. I also clarified the studOffset const by defining both values as their own constants: const studOffset = isImperialUnit ? STUD_OFFSET_IMPERIAL : STUD_OFFSET_METRIC;