-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/timelessco/renderlesskit-react-tailwind/73qcrd9tv |
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> | ||
); | ||
}; | ||
|
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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
<RangeCalendar> | |
<Calendar> |
src/calendar/stories/calendar.css
Outdated
/** 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 { |
There was a problem hiding this comment.
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 !
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]`; | ||
}); | ||
}); | ||
}), |
There was a problem hiding this comment.
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
* 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]>
No description provided.