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

fix(calendar): 🐛 find a way to use utilities for data attributes #13

Merged
merged 5 commits into from
Dec 21, 2020

Conversation

navin-moorthy
Copy link
Contributor

No description provided.

@navin-moorthy navin-moorthy self-assigned this Dec 17, 2020
@vercel
Copy link

vercel bot commented Dec 17, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/timelessco/renderlesskit-react-tailwind/73qcrd9tv
✅ Preview: https://renderlesskit-react-tailwind-git-calendar-data-styles.timelessco.vercel.app

Comment on lines +37 to +52
export interface RangeCalendarProps extends RangeCalendarInitialState {}

export const RangeCalendar: React.FC<RangeCalendarProps> = props => {
const { children } = props;
const ctx = useRangeCalendarState(props);
const context = React.useMemo(() => ctx, [ctx]);

return (
<CalendarProvider value={context}>
<RenderlessCalendar {...ctx} className={theme.calendar.base}>
{children}
</RenderlessCalendar>
</CalendarProvider>
);
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Creating a range calendar couldn't be so easier 😆


const RangeTemplate: Story = () => {
return (
<RangeCalendar>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Users just need to do this, they get normal/Range

Suggested change
<RangeCalendar>
<Calendar>

Comment on lines 8 to 12
/** Need to add the variant for our data variant via addVariant plugin */
/** Need to fix the tailwind override issue with focuswith with the new variants */
/** Tailwind override detects only the plain css doesn't support variants */
/** Or Look into styling the calendar like the storybook example from renderless component */
/* .calendar .calendar__cell[data-is-range-selection]:focus-within {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Things that needs to be solved later on when working on Calendar after design is done !

Comment on lines +64 to +108
plugin(function ({ addVariant, e }) {
addVariant("aria-selected", ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.${e(
`aria-selected${separator}${className}`,
)}[aria-selected="true"]`;
});
});
}),
plugin(function ({ addVariant, e }) {
addVariant("aria-disabled", ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.${e(
`aria-disabled${separator}${className}`,
)}[aria-disabled="true"]`;
});
});
}),
plugin(function ({ addVariant, e }) {
addVariant("is-range-selection", ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.${e(
`is-range-selection${separator}${className}`,
)}[data-is-range-selection]`;
});
});
}),
plugin(function ({ addVariant, e }) {
addVariant("is-range-start", ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.${e(
`is-range-start${separator}${className}`,
)}[data-is-selection-start]`;
});
});
}),
plugin(function ({ addVariant, e }) {
addVariant("is-range-end", ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.${e(
`is-range-end${separator}${className}`,
)}[data-is-selection-end]`;
});
});
}),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course, we can simplify this into a single plugin !
Left it separately for experimenting, we can simplify them at last IMO

@navin-moorthy navin-moorthy merged commit 90032fd into calendar Dec 21, 2020
@navin-moorthy navin-moorthy deleted the calendar-data-styles branch December 21, 2020 14:40
anuraghazra added a commit that referenced this pull request Dec 23, 2020
* feat: added calendar component, wip

* feat: calendar extract inline classes to theme file

* chore: improved colors

* feat: added initial datepicker

* chore: added stateless calendar

* feat(calendar): ✨  add new api calendar (#6)

* feat: added compound datepicker & range datepicker  (#5)

* feat: added compound datepicker & range datepicker

* fix(datepicker): fixed & improved typescript support

* chore: removed dot notation components

* chore: added custom input story example

* chore: datepicker export & css file added

* chore(deps): move & removed deps

* fix(calendar): 🐛  find a way to use utilities for data attributes (#13)

* fix(calendar): 🐛  find a way to use utilities for data attributes

* docs(calendar): 📝  add notes to calendar to solve later

* refactor(css): ♻️  remove old css

* refactor(css): ♻️  create a new css

* fix(datepicker): 🐛  fix datepicker styles

Co-authored-by: Navin Moorthy <[email protected]>
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