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

Feature/2824 date input #2864

Open
wants to merge 28 commits into
base: next
Choose a base branch
from
Open

Feature/2824 date input #2864

wants to merge 28 commits into from

Conversation

kwongz
Copy link
Contributor

@kwongz kwongz commented Nov 28, 2024

Description

Created DateInput component that builds off the DateRange structure. Redirects /components/date-range/ --> /components/date-input/

Allows users to access a single date or ranged date input calendar

image

image

Checklist

  • For UI or styling changes, I have added a screenshot or gif showing before & after
  • I have added a changeset
  • I have added to the docs where applicable
  • I have added to the VS Code extension where applicable

@kwongz
Copy link
Contributor Author

kwongz commented Nov 29, 2024

fixes #2824

@kwongz kwongz requested a review from archiewood November 29, 2024 15:49
@kwongz
Copy link
Contributor Author

kwongz commented Nov 29, 2024

@archiewood @mcrascal

Date Input w/ calendar (@steeze-ui/svelte-icon)

image

Date Input w/ inline title

image

Date Input w/ range + title (no calendar icon)

image

@kwongz
Copy link
Contributor Author

kwongz commented Dec 2, 2024

Added more margin between icon and text (m1 --> m2).

image

Date range for reference

image

@archiewood
Copy link
Member

archiewood commented Dec 2, 2024

calendar icon is improved

The separating bar between the Date Input and Jan 1, 1970 looks different to that used in the Dropdown to me (too heavy, does not extend high or low enough)

Can we match the styling

@kwongz
Copy link
Contributor Author

kwongz commented Dec 5, 2024

@ItsMeBrianD

Moved some functions used both in DateRange and DateInput, into a helper.js
Removed _DateRange (not being used)

I tried moving some of the query-building logic/ input store, but it felt like my changes were making the code more complicated, so I left them in the respective components.

@csjh csjh self-requested a review December 11, 2024 19:44

$: range = toBoolean(range);

const exec = getQueryFunction();
Copy link
Contributor

Choose a reason for hiding this comment

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

@ItsMeBrianD is there an alternative we should prefer to direct Query.create/getQueryFunction here

Copy link
Member

Choose a reason for hiding this comment

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

Yes you should use the utilities provided in buildQuery.js, Query.create should almost never be used in a component directly

@@ -39,6 +36,9 @@
/** @type {string | undefined} */
export let defaultValue;

/** @type {boolean} */
let range = true;
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need a range prop on DateRange? DateRange should always be a range in my opinion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed prop, is something like this better

image

Copy link
Member

Choose a reason for hiding this comment

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

Yes, remove the range variable entirely.

You can also use the shorthand for boolean props:

				<DateInput
					bind:selectedDateInput
					start={startString}
					end={endString}
					loaded={loaded?.ready ?? true}
					{presetRanges}
					{defaultValue}
					range <!-- this is equivalent to range={true} -->
				/>

@kwongz
Copy link
Contributor Author

kwongz commented Dec 13, 2024

To dos:

Take DateRange themes styling and apply them to _Date Input


$: range = toBoolean(range);

$: console.log(range);
Copy link
Member

Choose a reason for hiding this comment

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

Log


$: range = toBoolean(range);

const exec = getQueryFunction();
Copy link
Member

Choose a reason for hiding this comment

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

Yes you should use the utilities provided in buildQuery.js, Query.create should almost never be used in a component directly

selectedPreset = targetPreset;
console.log(targetPreset);
Copy link
Member

Choose a reason for hiding this comment

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

Remove debug log

Suggested change
console.log(targetPreset);

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.

5 participants