Skip to content

Commit

Permalink
Code style improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdan Stanga authored and vtemian committed Mar 26, 2020
1 parent 4b91192 commit 251ef06
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const LightButton = styled.button`
background-color: ${color.white};
border: 1px solid ${color.black};
cursor: pointer;
padding: ${spacing.extrasmall} ${spacing.small};
padding: ${spacing.extraSmall} ${spacing.small};
border-radius: ${borderRadius.small};
font-size: ${fontSize.medium};
&:hover{
Expand Down
2 changes: 1 addition & 1 deletion src/components/Section.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Section = styled.div`
Section.propTypes = {
align: PropTypes.oneOf(["left", "right", "center"]),
textSize: PropTypes.oneOf(["small", "medium", "large", "huge"]),
bottom: PropTypes.oneOf(["initial", "extrasmall", "small", "medium", "large"]),
bottom: PropTypes.oneOf(["initial", "extraSmall", "small", "medium", "large"]),
};

Section.defaultProps = {
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const color = {
};

export const spacing = {
extrasmall: "5px",
extraSmall: "5px",
small: "15px",
medium: "35px",
large: "65px",
Expand Down
17 changes: 14 additions & 3 deletions src/pages/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,17 @@ const CSSReset = createGlobalStyle`
}
`;

const CANVAS_SIZE = {
maxWidth: 760,
maxHeight: 200,
};

function Main() {
const [isGenerated, setIsGenerated] = useState(false);
const [canvasSize, setCanvasSize] = useState({width: Math.min(window.screen.width, 760), height: 200});
const [canvasSize, setCanvasSize] = useState({
width: Math.min(window.screen.width, CANVAS_SIZE.maxWidth),
height: CANVAS_SIZE.maxHeight,
});

const emptyValues = {
nume: undefined,
Expand Down Expand Up @@ -111,7 +119,10 @@ function Main() {

useEffect(() => {
const onResizeWindow =() => {
setCanvasSize({width: Math.min(window.screen.width, 760), height: canvasSize.height});
setCanvasSize({
width: Math.min(window.screen.width, CANVAS_SIZE.maxWidth),
height: CANVAS_SIZE.maxHeight,
});
};
window.addEventListener('resize', onResizeWindow);
return () => window.removeEventListener('resize', onResizeWindow)
Expand Down Expand Up @@ -201,7 +212,7 @@ function Main() {
</CheckboxLabel>
</Section>

<Section bottom="extrasmall">
<Section bottom="extraSmall">
Semnatura
<Signature>
<SignatureCanvas
Expand Down

1 comment on commit 251ef06

@vercel
Copy link

@vercel vercel bot commented on 251ef06 Mar 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.