Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialog+tabs #773

Closed
wants to merge 29 commits into from
Closed

Dialog+tabs #773

wants to merge 29 commits into from

Conversation

@netlify
Copy link

netlify bot commented Aug 5, 2023

Deploy Preview for bldrs-share ready!

Name Link
🔨 Latest commit 071721a
🔍 Latest deploy log https://app.netlify.com/sites/bldrs-share/deploys/64de7d8a8c1d9e00098c5111
😎 Deploy Preview https://deploy-preview-773--bldrs-share.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

src/Components/Dialog.jsx Outdated Show resolved Hide resolved
src/Components/Library/DialogTabs.jsx Outdated Show resolved Hide resolved
src/Components/Library/TabsSimple.jsx Outdated Show resolved Hide resolved
@OlegMoshkovich OlegMoshkovich marked this pull request as ready for review August 9, 2023 13:13
Copy link
Member

@pablo-mayrgundter pablo-mayrgundter left a comment

Choose a reason for hiding this comment

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

Looks much cleaner!

A few comments inline

@@ -40,7 +40,7 @@ export default function Dialog({
onClose={close}
PaperProps={{variant: 'control'}}
>
<CloseButton onClick={close}/>
<CloseButton onClick={close} className='icon-share'/>
Copy link
Member

Choose a reason for hiding this comment

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

Mmm.. this class should only go on icons, like . That's how I have it everywhere in the refactor I did and we should keep that as an invariant.

In general as well, if we have a class name starting with a component name, like "icon", it should only go directly on a component of that type. Just to keep sanity


const tabList = ['Explore', 'Open', 'Save']
const contentList = [
<Box sx={{textAlign: 'left'}} key={1}>
Copy link
Member

Choose a reason for hiding this comment

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

These left aligns feel more semantic than style, as in "block text" means something different, like it's prose to read.

'h5' is also semantic, meaning a 5th-level header.

I think what we want here is to replace Box+Typography with just a for Paragraph.

Isn't this whole section

headerText={'Here\'s the thing!'}
isDialogDisplayed={true}
// eslint-disable-next-line no-empty-function
setIsDialogDisplayed={() => {}}
Copy link
Member

Choose a reason for hiding this comment

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

For fixtures, tests, etc. where we have an empty function I've been putting e.g. debug().log('setIsDialogDisplayed')

isDialogDisplayed,
setIsDialogDisplayed,
actionTitle,
actionCb = [() => alert('loading')],
Copy link
Member

Choose a reason for hiding this comment

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

This I think should be required and asserted instead of a default. We don't want to be refactoring and forget to pass a handler but then get an alert in prod.

Copy link
Member Author

Choose a reason for hiding this comment

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

If the default prop is not passed, there is an error.

Copy link
Member Author

Choose a reason for hiding this comment

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

Since we are using the state as the array position, if the default prop of the array is not passed there is a moment on load when the undefined error is thrown.

Copy link
Member

Choose a reason for hiding this comment

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

per convo, rename to actionCbArr

import {assertDefined} from '../utils/assert'


/**
Copy link
Member

Choose a reason for hiding this comment

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

I was having a look at refactoring this and one thing I think helped is to make most props optional. Only things that are really required are:

  • headerText
  • tabList
  • contentList
  • actionCb (actionTitle can be 'Ok' by default')

Copy link
Member Author

Choose a reason for hiding this comment

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

how do you make props optional, with the assert?

* @property {React.ReactElement} [actionIcon] Optional icon for the action button
* @return {React.Component}
*/
export default function Dialog({
Copy link
Member

Choose a reason for hiding this comment

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

should be DialogTabs

Copy link
Member Author

@OlegMoshkovich OlegMoshkovich left a comment

Choose a reason for hiding this comment

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

isDialogDisplayed,
setIsDialogDisplayed,
actionTitle,
actionCb = [() => alert('loading')],
Copy link
Member Author

Choose a reason for hiding this comment

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

Since we are using the state as the array position, if the default prop of the array is not passed there is a moment on load when the undefined error is thrown.

import {assertDefined} from '../utils/assert'


/**
Copy link
Member Author

Choose a reason for hiding this comment

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

how do you make props optional, with the assert?

@OlegMoshkovich OlegMoshkovich deleted the dialog+tabs branch February 14, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants