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

DT-5926: Datetimepicker for generated components #4900

Open
wants to merge 10 commits into
base: v3
Choose a base branch
from
Open

DT-5926: Datetimepicker for generated components #4900

wants to merge 10 commits into from

Conversation

Dvun
Copy link
Contributor

@Dvun Dvun commented Dec 1, 2023

Proposed Changes

  • Datetimepicker for generated components

Pull Request Check List

  • A reasonable set of unit tests is included
  • Console does not show new warnings/errors
  • Changes are documented or they are self explanatory
  • This pull request does not have any merge conflicts
  • All existing tests pass in CI build
  • Code coverage does not decrease (unless measured incorrectly)

Review

  • Read and verify the code changes
  • Test the functionality by running the UI locally with all popular browsers available in your platform
  • Check that the implementation matches the design, when such one is defined in a Jira issue
  • Merge the pull request

return (
<div
className={`embedded-seach-container ${
bikeOnly ? 'bike' : walkOnly ? 'walk' : ''
}`}
id={appElement}
style={{ height: isTimepickerSelected ? '380px' : '250px' }}
Copy link
Member

Choose a reason for hiding this comment

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

This could be moved sass file by providing a class name here if the timepicker is selected.

>
<div className="background-container">{drawBackgroundIcon()}</div>
<div className="control-panel-container">
<div className="control-panel-container" style={{ position: 'relative' }}>
Copy link
Member

Choose a reason for hiding this comment

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

This style could be potentially moved to sass as well.


<div
className="embedded-search-button-container"
style={{ margin: '10px 0 0 0' }}
Copy link
Member

Choose a reason for hiding this comment

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

This style can be moved to sass.

lang={lang}
color={colors.primary}
timeZone={config.timezoneData.split('|')[0]}
serviceTimeRange={context.config.itinerary.serviceTimeRange}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
serviceTimeRange={context.config.itinerary.serviceTimeRange}
serviceTimeRange={config.itinerary.serviceTimeRange}

@@ -411,6 +431,34 @@ const EmbeddedSearchGenerator = (props, context) => {
)}
</fieldset>

<fieldset id="timePicker">
Copy link
Member

Choose a reason for hiding this comment

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

I think we should use time-picker style naming instead of timePicker for ids and class names.

onOpen={onOpen}
onClose={onClose}
openPicker={state.open}
isHideCloseButton={state.isHideCloseButton}
Copy link
Member

Choose a reason for hiding this comment

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

I think better name for this parameter could be isAlwaysOpen, this is used in multiple files so rename it everywhere. The design images showed that the grey background should be removed when the timepicker is rendered from the embedded search. You should use this same prop to remove the grey background if this is true.

Comment on lines 375 to 381
const onClose = () => {
setState({ ...state, open: false });
};

const onOpen = () => {
setState({ ...state, open: true });
};
Copy link
Member

Choose a reason for hiding this comment

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

I think these can be removed if we force the timepicker to be always open in this view and open can be removed from state.

fontWeights={config.fontWeights}
onOpen={onOpen}
onClose={onClose}
openPicker={state.open}
Copy link
Member

Choose a reason for hiding this comment

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

This can be hard-coded as true.

isHideCloseButton: true,
time: undefined,
arriveBy: false,
keepPickerOpen: false,
Copy link
Member

Choose a reason for hiding this comment

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

I think this keepPickerOpen can be removed as well from everywhere here.

Comment on lines 90 to 92
margin: 0 !important;
padding: 0 !important;
max-width: 399px !important;
Copy link
Member

Choose a reason for hiding this comment

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

We should try to avoid using these !important style definitions. I think the issue here is probably that the styles from here leak to the timepicker. We should either make those generic style definitions here that affect all html elements be more specific and only affect certain classes or make some wrapper divs for the other elements in the generator and make the generic styles under those divs so they don't affect the preview.

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.

2 participants