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

Timepicker component #31

Closed
wants to merge 8 commits into from
Closed

Conversation

Hasmik8
Copy link
Contributor

@Hasmik8 Hasmik8 commented Oct 20, 2020

Description

I've created Timepicker component, which has one prop parameter, which is the value and it's date. It's not a required parameter.

Here are screenshots:
Снимок экрана от 2020-10-20 16-54-29
Снимок экрана от 2020-10-20 16-54-53
Снимок экрана от 2020-10-20 16-55-07
Снимок экрана от 2020-10-20 16-55-29
Снимок экрана от 2020-10-20 16-55-45

@Hasmik8 Hasmik8 added adding-component enhancement New feature or request labels Oct 21, 2020
@Hasmik8 Hasmik8 linked an issue Oct 21, 2020 that may be closed by this pull request
package.json Outdated
Comment on lines 54 to 55
"@date-io/date-fns": "^1.3.13",
"@date-io/moment": "^1.3.13",
Copy link
Contributor

Choose a reason for hiding this comment

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

These are packages for Date Picker, we are building a time picker so this is not required here.

package.json Outdated
Comment on lines 58 to 59
"date-fns": "^2.16.1",
"moment": "^2.29.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

Again these packages are for date pickers, not time pickers. You'd only need KeyboardTimePicker from @material-ui/pickers

"@material-ui/core": "^4.10.2",
"@material-ui/pickers": "^3.2.10",
Copy link
Contributor

Choose a reason for hiding this comment

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

We would also need this as a peer dependency

Copy link
Contributor

Choose a reason for hiding this comment

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

@Hasmik8 we can add the same in "peerDependencies": {}

value?: Date;
}

const BaseTimePicker: React.FC<TimePickerProps> = ({ value }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const BaseTimePicker: React.FC<TimePickerProps> = ({ value }) => {
const TimePicker: React.FC = () => {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@S-ayanide no need to pass this value via props?

Copy link
Contributor

Choose a reason for hiding this comment

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

Date is not required to be passed as props

Comment on lines 7 to 9
interface TimePickerProps extends BaseTimePickerProps {
value?: Date;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Time Picker will not take a Date

Comment on lines 1 to 5
import { makeStyles } from '@material-ui/core';

const useStyles = makeStyles(() => ({}));

export { useStyles };
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 are no styles required we can simply not have a styles.ts file instead!

@@ -0,0 +1 @@
export * from './BaseTimePicker';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export * from './BaseTimePicker';
export * from './TimePicker';

@@ -1 +1,2 @@
export * from './Button';
export * from './Timepicker';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export * from './Timepicker';
export * from './TimePicker';

Can we also camel case time file name for the same!

Comment on lines 1 to 3
import { TimePickerProps } from '@material-ui/pickers';

export type BaseTimePickerProps = Omit<TimePickerProps, 'value'>;
Copy link
Contributor

Choose a reason for hiding this comment

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

We should be able to use the basic props provided by KeyboardTimePicker, there's no requirement to omit any

// Litmus Portal
.add('Litmus Portal', () => (
<ThemedBackground platform="litmus-portal">
<BaseTimePicker onChange={() => console.log('timepicker')} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<BaseTimePicker onChange={() => console.log('timepicker')} />
<BaseTimePicker onChange={() => console.log('Time Changed')} />

@S-ayanide
Copy link
Contributor

package-lock.json is not required, can you please delete that! We are using yarn.lock instead

Signed-off-by: Hasmik8 <[email protected]>
value?: Date;
}

const BaseTimePicker: React.FC<TimePickerProps> = ({ value }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Date is not required to be passed as props

Comment on lines 12 to 13
const date = value != undefined ? value : new Date();
const [selectedDate, handleDateChange] = useState<Date | null>(date);
Copy link
Contributor

Choose a reason for hiding this comment

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

No, Date shouldn't be passed

@S-ayanide
Copy link
Contributor

Please resolve the above comments as well

Signed-off-by: Hasmik8 <[email protected]>
Signed-off-by: Hasmik8 <[email protected]>
@AVRahul
Copy link
Contributor

AVRahul commented Oct 29, 2020

As discussed earlier, package-lock.json file is not required as part of this PR. as we are maintaining the yarn.lock instead.

"@material-ui/core": "^4.10.2",
"@material-ui/pickers": "^3.2.10",
Copy link
Contributor

Choose a reason for hiding this comment

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

@Hasmik8 we can add the same in "peerDependencies": {}

@Hasmik8
Copy link
Contributor Author

Hasmik8 commented Oct 29, 2020

@AVRahul I'm running this command npm install --peer @material-ui/pickers and it doesn't add peerDependencies

@AVRahul
Copy link
Contributor

AVRahul commented Oct 29, 2020

@Hasmik8 You can also copy paste the same in peerDependecies manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CC: Time Picker
4 participants