Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Questions.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Questions


---

## --- OLD Questions below -> still need to be fixed ---

## Do I need to change my 'yourCoin' ids to support multiple users? How to structure data?

Situation:
Expand Down
57 changes: 30 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
]
},
"devDependencies": {
"prettier": "2.5.1"
"@types/jest": "^27.4.1",
"@types/node": "^17.0.25",
"@types/react": "^18.0.6",
"@types/react-dom": "^18.0.2",
"prettier": "2.5.1",
"typescript": "^4.6.3"
}
}
2 changes: 1 addition & 1 deletion src/components/Auth/SignUpForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const SignUpForm = () => {
autoComplete='current-password'
placeholder='Password'
required
minLength={6}
minlength={6}
value={signUpPassword}
onChange={(e) => setSignUpPassword(e.target.value)}
/>
Expand Down
76 changes: 38 additions & 38 deletions src/components/Button/Button.css
Original file line number Diff line number Diff line change
@@ -1,85 +1,85 @@
.Button {
padding: 5px;
border: 1px solid #2151f5;
padding: 11px 16px;
border-radius: 4px;
font-size: 15px;
font-weight: 600;
background-color: #2151f5;
color: white;
cursor: pointer;
padding: 5px;
border: 1px solid #2151f5;
padding: 11px 16px;
border-radius: 4px;
font-size: 15px;
font-weight: 600;
background-color: #2151f5;
color: white;
cursor: pointer;
}

.Button:hover {
background-color: #1d48d6;
background-color: #1d48d6;
}

.Button:disabled {
cursor: not-allowed;
}

.btn-secondary {
background-color: white;
color: black;
border: 1px solid #d8d8d8;
background-color: white;
color: black;
border: 1px solid #d8d8d8;
}

.btn-secondary:hover {
background-color: rgb(241, 241, 241);
background-color: rgb(241, 241, 241);
}

.btn-danger {
background-color: #cf202f;
color: white;
border: 1px solid #cf202f;
background-color: #cf202f;
color: white;
border: 1px solid #cf202f;
}

.btn-danger:hover {
background-color: rgb(233, 66, 66);
background-color: rgb(233, 66, 66);
}

.btn-xl {
padding: 22px;
width: 100%;
padding: 22px;
width: 100%;
}

.btn-xxl {
padding: 32px;
width: 100%;
padding: 32px;
width: 100%;
}

.btn-stretch {
width: 100%;
}

.btn-disabled {
cursor: not-allowed;
width: 100%;
}

.btn-light {
border: none;
background-color: white;
border: none;
background-color: white;
}

.btn-light.btn-primary {
color: #2151f5;
color: #2151f5;
}

.btn-light.btn-primary:hover {
color: #1d48d6;
background-color: white;
color: #1d48d6;
background-color: white;
}

.btn-light.btn-secondary {
color: black;
color: black;
}

.btn-light.btn-secondary:hover {
color: black;
background-color: white;
color: black;
background-color: white;
}

.btn-light.btn-danger {
color: #cf202f;
color: #cf202f;
}

.btn-light.btn-danger:hover {
color: #cf202f;
background-color: white;
color: #cf202f;
background-color: white;
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
import './Button.css';

import { ComponentProps, FC } from 'react';

import classNames from 'classnames';

const Button = ({
interface ButtonProps extends ComponentProps<'button'> {
children: string;
Copy link
Copy Markdown
Collaborator

@snqb snqb Apr 20, 2022

Choose a reason for hiding this comment

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

  1. FC already has types for children, so no need to put it here.
  2. children are ReactNode AFAIK, not string. (ReactNode includes string)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

  1. Good to know, thanks. I read afterwards that it's a good idea to make it explicit, when a component is accepting children (as some components don't). Thus it might be good to leave it. Do you agree?

  2. In this Button case I actually only want text as children. Is string ok then because it is more specific?

light?: boolean;
stretch?: boolean;
color?: 'primary' | 'secondary' | 'danger';
size?: 'md' | 'xl' | 'xxl';
}

const Button: FC<ButtonProps> = ({
children,
color,
disabled,
light,
size,
stretch,
onClick,
type,
color,
size,
...buttonProps
}) => {
const btnClasses = classNames({
Button: true,
'btn-light': light,
'btn-stretch': stretch,
'btn-primary': color === 'primary',
'btn-secondary': color === 'secondary',
'btn-danger': color === 'danger',
'btn-md': size === 'md',
'btn-xl': size === 'xl',
'btn-xxl': size === 'xxl',
'btn-stretch': stretch,
'btn-disabled': disabled,
'btn-light': light,
});

return (
<button className={btnClasses} onClick={onClick} type={type}>
<button {...buttonProps} className={btnClasses}>
{children}
</button>
);
Expand Down
7 changes: 0 additions & 7 deletions src/components/Content/Content.jsx

This file was deleted.

11 changes: 11 additions & 0 deletions src/components/Content/Content.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import './Content.css';

import { FC, ReactNode } from 'react';

interface ContentProps {
children: ReactNode;
}

const Content: FC<ContentProps> = ({ children }) => <div className='Content'>{children}</div>;

export default Content;
7 changes: 0 additions & 7 deletions src/components/Content/ContentCenter.jsx

This file was deleted.

13 changes: 13 additions & 0 deletions src/components/Content/ContentCenter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import './ContentCenter.css';

import { FC, ReactNode } from 'react';

interface ContentCenterProps {
children: ReactNode;
}
Comment on lines +5 to +7
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

children are in FC already

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I have to admit FC with Typescript confuses me :).

First, I stumbled upon sooo many ressources discouraging the use of FC, e.g. https://fettblog.eu/typescript-react-why-i-dont-use-react-fc/.
So FC automatically adds children type to all React components? That's probably bas I want to be explicit about it, correct? What's your take on it?

Then, based on you comment I tried FC without children, but get Typescript errors. Here is what I tried:
const Content: FC = ({ children }) => { return <div className='Content'>{children}</div>; };

Error message: 'Property children does not exist on type {}'. What am I doing wrong?


const ContentCenter: FC<ContentCenterProps> = ({ children }) => {
return <div className='ContentCenter'>{children}</div>;
};

export default ContentCenter;
7 changes: 0 additions & 7 deletions src/components/Content/ContentRight.jsx

This file was deleted.

13 changes: 13 additions & 0 deletions src/components/Content/ContentRight.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import './ContentRight.css';

import { FC, ReactNode } from 'react';

interface ContentRightProps {
children: ReactNode;
}

const ContentRight: FC<ContentRightProps> = ({ children }) => {
return <div className='ContentRight'>{children}</div>;
};

export default ContentRight;
Loading