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

style(RangeCalendarStyled): 💄 convert story to vanilla css #402

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
style(calendarStyled): 💄 Convert calendarStyled Story to Vanilla CSS
Fixes #378
  • Loading branch information
mcnaveen committed Nov 7, 2022
commit 7f98c8c24b77b98e95462ebe58960d8e2432a050
28 changes: 9 additions & 19 deletions src/calendar/stories/CalendarStyled.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import {

import { ChevronLeft, ChevronRight } from "./Utils.component";

import "./CalendarStyled.css";

export type CalendarStyledProps = Omit<
CalendarBaseStateProps,
"locale" | "createCalendar"
Expand All @@ -34,26 +36,14 @@ export const CalendarStyled: React.FC<CalendarStyledProps> = props => {
const calendar = useCalendarState({ ...props, state });

return (
<Calendar
state={calendar}
className="p-3 bg-white rounded-md shadow-lg styled-datepicker calendar w-max"
>
<div className="flex justify-between">
<CalendarPreviousButton
state={calendar}
className="text-gray-700 px-2 py-1 rounded-md focus:outline-none focus:ring-2 focus:ring-border-400"
>
<ChevronLeft className="flex-shrink-0 w-4" />
<Calendar state={calendar} className="calendar">
<div className="calendar--wrapper">
<CalendarPreviousButton state={calendar} className="calendar__button">
<ChevronLeft className="calendar__button_chevron" />
</CalendarPreviousButton>
<CalendarTitle
state={calendar}
className="text-sm font-bold text-gray-700 px-2 py-1"
/>
<CalendarNextButton
state={calendar}
className="text-gray-700 px-2 py-1 rounded-md focus:outline-none focus:ring-2 focus:ring-border-400"
>
<ChevronRight className="flex-shrink-0 w-4" />
<CalendarTitle state={calendar} className="calendar__title" />
<CalendarNextButton state={calendar} className="calendar__button">
<ChevronRight className="calendar__button_chevron" />
</CalendarNextButton>
</div>
<CalendarGridComp state={state} />
Expand Down
48 changes: 48 additions & 0 deletions src/calendar/stories/CalendarStyled.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.calendar {
padding: 1rem;
background-color: #ffffff;
width: max-content;
border-radius: 0.375rem;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.calendar--wrapper {
display: flex;
justify-content: space-between;
}

.calendar__button {
padding-top: 0.25rem;
padding-bottom: 0.25rem;
padding-left: 0.5rem;
padding-right: 0.5rem;
color: #374151;
background-color: #ffffff !important;
border-radius: 0.375rem;
border: none !important;
}

.calendar__button:focus {
outline: none;
}

.calendar__button_chevron {
flex-shrink: 0;
width: 1rem;
}

.calendar__title {
padding-top: 0.25rem;
padding-bottom: 0.25rem;
padding-left: 0.5rem;
padding-right: 0.5rem;
color: #374151;
font-size: 0.875rem;
line-height: 1.25rem;
font-weight: 700;
}

.dates {
padding: 0.75rem;
}
8 changes: 0 additions & 8 deletions src/calendar/stories/CalendarStyled.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import jsUtils from "./templates/UtilsJsx";
import tsUtils from "./templates/UtilsTsx";
import { CalendarStyled } from "./CalendarStyled.component";

import "./tailwind.css";

type Meta = ComponentMeta<typeof CalendarStyled>;
// type Story = ComponentStoryObj<typeof CalendarStyled>;

Expand All @@ -21,12 +19,6 @@ export default {
layout: "centered",
preview: createPreviewTabs({ js, ts, jsUtils, tsUtils }),
},
decorators: [
Story => {
document.body.id = "tailwind";
return <Story />;
},
],
} as Meta;

export const Default = () => {
Expand Down