-
-
Notifications
You must be signed in to change notification settings - Fork 23
Conversation
На первый взгляд не надо выносить PopupButton отдельно, так как его переиспользуемость равна единице. |
Перенесла атом PopUp к кнопке. |
PopUpButton перенесла к карточке (пока со своим стейтом), теперь это просто кнопка. PopUp остался в организмах |
> | ||
PopUp | ||
</Button> | ||
{!!popup && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need !!
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a discussion on React Telegram about that. I saw this !! in few popup examples, people said that it is reinsurance for some cases. Please confirm that I need to delete it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can delete it
Do you absolutely sure you want to delete? Just kidding we are | ||
archiving them anyway. | ||
</p> | ||
<Button onClick={() => true}>Yes</Button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just call props.onDeleteClick
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am waiting for API with a real delete function, and alerts are blocked by husky, so this is a temporary dummy. Could I keep it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use defaultProps
|
||
const PopUpButton = () => { | ||
const [popup, setPopup] = useState(false) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should create const here:
const close = () => setOpened(opened => !opened)
And use close
fn in onClose
prop in PopUp
setPopup(() => false) | ||
}} | ||
> | ||
<Box popup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that button and <Box popup>
should be inside PopUp
component
CLOSE (should be x icon in the corner) | ||
</Button> | ||
|
||
<H3>Do you want to delete?</H3> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we can create a Confirm
component. Usage example:
<Confirm
onCancel={close}
onConfirm={deleteCard}
text="Do you absolutely sure you want to delete?"
/>
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2); | ||
//transform: scale(1.001); | ||
} | ||
${({ sticky }) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You really need sticky
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to replace Card-atom with Box-atom later. Keep name "card" just for feature-components and Box as styled component. So later I am going to remove sticky from Card with whole Card-atom.
|
||
export const PopUp = ({ children, onClose }) => { | ||
const ref = useRef(null) | ||
const onDocumentClick = (event) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use useCallback
here.
because in useEffect
on unmount used new function, but new function do not removed
All changes were done in #46. |
Popups added