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
Prev Previous commit
style(RangeCalendarStyled): 💄 convert story to vanilla css
Fixes #377
  • Loading branch information
mcnaveen committed Nov 10, 2022
commit 806eef058f64ec1dd0873d2c816d9c6551c5a6fd
25 changes: 9 additions & 16 deletions src/range-calendar/stories/RangeCalendarStyled.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import {
useRangeCalendarState,
} from "../../index";

import "./RangeCalendarStyled.css";

export type RangeCalendarStyledProps = Omit<
RangeCalendarBaseStateProps,
"locale" | "createCalendar"
Expand All @@ -38,26 +40,17 @@ export const RangeCalendarStyled: React.FC<
const calendar = useRangeCalendarState({ ...props, state });

return (
<RangeCalendar
state={calendar}
className="p-3 bg-white rounded-md shadow-lg styled-datepicker calendar w-max"
>
<div className="flex justify-between">
<RangeCalendar state={calendar} className="rangecalendar">
<div className="rangecalendar--wrapper">
<CalendarPreviousButton
state={calendar}
className="text-gray-700 px-2 py-1 rounded-md focus:outline-none focus:ring-2 focus:ring-border-400"
className="rangecalendar__button"
>
<ChevronLeft className="flex-shrink-0 w-4" />
<ChevronLeft className="rangecalendar__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="rangecalendar__title" />
<CalendarNextButton state={calendar} className="rangecalendar__button">
<ChevronRight className="rangecalendar__button_chevron" />
</CalendarNextButton>
</div>
<CalendarGridComp state={state} />
Expand Down
99 changes: 99 additions & 0 deletions src/range-calendar/stories/RangeCalendarStyled.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
.rangecalendar {
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);
}

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

.rangecalendar__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;
}

.rangecalendar__button:focus {
cursor: pointer;
outline: none;
}

.rangecalendar__button_chevron {
flex-shrink: 0;
width: 1rem;
cursor: pointer;
}

.rangecalendar__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;
}

.rangecalendar[data-is-range-selection] {
background-color: #dbeafe;
color: #1f2937;
border-radius: 0;
}
.rangecalendar[data-is-selection-start] {
color: #ffffff !important;
background-color: #3b82f6 !important;
}
.rangecalendar[data-is-selection-end] {
color: #ffffff !important;
background-color: #3b82f6 !important;
}

.rangecalendar[data-is-range-selection]:focus-within {
color: #ffffff !important;
background-color: #3b82f6 !important;
}
.rangecalendar:focus-within {
color: #6b7280;
}

.rangecalendar [data-weekend] {
color: #dc2626;
}

.rangecalendar [aria-selected="true"] {
color: #ffffff;
background-color: #3b82f6;
}

.rangecalendar [aria-selected]:focus-within {
color: #6b7280;
}

.rangecalendar [aria-selected="true"]:focus-within {
color: #ffffff;
background-color: #3b82f6;
}

.rangecalendar [aria-disabled="true"] {
color: #6b7280;
}

.rangecalendar span {
outline: none;
cursor: pointer;
}
8 changes: 0 additions & 8 deletions src/range-calendar/stories/RangeCalendarStyled.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 { RangeCalendarStyled } from "./RangeCalendarStyled.component";

import "./tailwind.css";

type Meta = ComponentMeta<typeof RangeCalendarStyled>;

export default {
Expand All @@ -20,12 +18,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
53 changes: 0 additions & 53 deletions src/range-calendar/stories/tailwind.css

This file was deleted.