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

docs(many): function based examples are added to ToggleButton, Trucat… #1629

Conversation

ToMESSKa
Copy link
Contributor

@ToMESSKa ToMESSKa commented Aug 7, 2024

…eText and TimeSelect

Closes: INSTUI-4153

@ToMESSKa ToMESSKa self-assigned this Aug 7, 2024
Copy link

github-actions bot commented Aug 7, 2024

PR Preview Action v1.4.7
Preview removed because the pull request was closed.
2024-08-14 12:11 UTC

@ToMESSKa ToMESSKa marked this pull request as ready for review August 7, 2024 12:14
@ToMESSKa ToMESSKa requested review from matyasf and balzss August 7, 2024 12:15
Copy link
Contributor

@balzss balzss left a comment

Choose a reason for hiding this comment

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

looks good, all problems are from the original examples but we should fix those regardless


- ```js
const InverseExample = () => {
const [lockedStatus, setLockedStatus] = useState('off')
Copy link
Contributor

Choose a reason for hiding this comment

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

the original example is kind of strange for this. lockedStatus could be a boolean variable so this strange conversion wouldn't be needed

Copy link
Collaborator

Choose a reason for hiding this comment

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

agree

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I simplified the code with a boolean

<ToggleButton
status={locked ? 'pressed' : 'unpressed'}
color="primary-inverse"
renderIcon={locked ? IconLockSolid : IconUnlockLine}
screenReaderLabel={locked ? 'Unlock assignment' : 'Lock assignment'}
renderTooltipContent={locked ? 'Unlock' : 'Lock'}
onClick={this.handleLocked}
onClick={handleLocked}
mountNode={() => document.getElementById('inverseToggleContainer')}
Copy link
Contributor

Choose a reason for hiding this comment

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

this prop is also a bit strange. does it work without it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I works without it, removed

render(<InverseExample />)
```
render(<InverseExample />)
```
Copy link
Contributor

Choose a reason for hiding this comment

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

if there was no problem with my suggestions could you please fix the original examples too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

- ```javascript
class Example extends React.Component {
state = {
value: '2020-05-18T23:59:00'
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a strange default value if the steps are 15 mins which makes is value basically invalid. could be better to remove or change it

Copy link
Collaborator

Choose a reason for hiding this comment

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

I remember that this use case was specifically requested (default value could be something that is not in the dropdown), so I'd leave it here. The explanation when this is used to set a deadline its default is 1 min before midnight, which the user should be able to change.

When we make a new TimeSelect it should handle this better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left this unchanged.

@ToMESSKa ToMESSKa force-pushed the INSTUI-4153_write_functional_examples_for_truncatetext_togglebutton_and_timeselect branch from 8c2ca4b to 1d3e78a Compare August 13, 2024 07:50
@ToMESSKa ToMESSKa requested a review from balzss August 13, 2024 07:58
@ToMESSKa ToMESSKa merged commit 6e96579 into master Aug 14, 2024
11 checks passed
@ToMESSKa ToMESSKa deleted the INSTUI-4153_write_functional_examples_for_truncatetext_togglebutton_and_timeselect branch August 14, 2024 12:10
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