Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion packages/styled/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@power-rent/react-datepicker-modern",
"version": "1.0.3",
"version": "1.0.4",
"description": "A React datepicker build with styled-components.",
"keywords": [
"datepicker",
Expand Down
22 changes: 12 additions & 10 deletions packages/styled/src/components/Close/Close.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,18 @@ function Close({onClick, rtl, closeText}: CloseProps) {
aria-label="Close"
>
<CloseIcon width="15px" height="16px" color="#ADADAD" />
<Text
m={theme.closeMargin}
// @ts-ignore
color={theme.closeColor}
fontSize={theme.closeFontSize}
fontFamily={theme.fontFamily}
fontWeight={theme.closeFontWeight}
>
{closeText}
</Text>
{closeText && (
<Text
m={theme.closeMargin}
// @ts-ignore
color={theme.closeColor}
fontSize={theme.closeFontSize}
fontFamily={theme.fontFamily}
fontWeight={theme.closeFontWeight}
>
{closeText}
</Text>
)}
</Wrapper>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ interface AppProps {
onDayRender?(date: Date): React.ReactNode
unavailableDates?: Date[]
initialVisibleMonth?: Date
datepickerCloseWrapperRightCustom?: string | null
datepickerPaddingCustom?: string | null
}

function App({
Expand All @@ -76,6 +78,8 @@ function App({
monthLabelFormat = monthLabelFormatFn,
onDayRender = undefined,
unavailableDates = [],
datepickerCloseWrapperRightCustom = null,
datepickerPaddingCustom = null,
}: AppProps) {
const [state, dispatch] = useReducer(reducer, initialState)

Expand Down Expand Up @@ -111,6 +115,8 @@ function App({
onDayRender={onDayRender}
unavailableDates={unavailableDates}
initialVisibleMonth={initialVisibleMonth}
datepickerCloseWrapperRightCustom={datepickerCloseWrapperRightCustom}
datepickerPaddingCustom={datepickerPaddingCustom}
/>
)
}
Expand All @@ -124,5 +130,7 @@ storiesOf('DateRangeInputModern', module).add('Simple demo', () => (
showClose={boolean('showClose', true)}
showSelectedDates={boolean('showSelectedDates', true)}
displayFormat={text('displayFormat', 'MM/dd/yyyy')}
datepickerCloseWrapperRightCustom={text('datepickerCloseWrapperRightCustom', '10px')}
datepickerPaddingCustom={text('datepickerPaddingCustom', '10px')}
/>
))
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ export interface DateRangeInputModernProps extends UseDatepickerProps {
datepickerLeftCustom?: string
datepickerTopCustom?: string
datepickerZIndexCustom?: number | null
datepickerPaddingCustom?: string | null
datepickerCloseWrapperRightCustom?: string | null
}

function DateRangeInputModern({
Expand Down Expand Up @@ -157,7 +159,8 @@ function DateRangeInputModern({
datepickerHeightCustom,
datepickerLeftCustom,
datepickerTopCustom,
datepickerZIndexCustom,
datepickerPaddingCustom,
datepickerCloseWrapperRightCustom,
}: DateRangeInputModernProps) {
const ref = useRef(null)
const datepickerWrapperRef = useRef<HTMLDivElement>(null)
Expand Down Expand Up @@ -306,7 +309,8 @@ function DateRangeInputModern({
datepickerBorderRadius={datepickerBorderRadiusCustom}
datepickerWidth={datepickerWidthCustom}
datepickerHeight={datepickerHeightCustom}
datepickerZIndex={datepickerZIndexCustom}
datepickerPadding={datepickerPaddingCustom}
datepickerCloseWrapperRight={datepickerCloseWrapperRightCustom}
/>
)}
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ interface AppProps {
onDayRender?(date: Date): React.ReactNode
unavailableDates?: Date[]
initialVisibleMonth?: Date
datepickerPadding?: string | null
datepickerCloseWrapperRight?: string | null
}

function App({
Expand All @@ -64,6 +66,8 @@ function App({
monthLabelFormat = monthLabelFormatFn,
onDayRender = undefined,
unavailableDates = [],
datepickerPadding = null,
datepickerCloseWrapperRight = null,
}: AppProps) {
const [state, setState] = useState<OnDatesChangeProps>({
startDate: null,
Expand Down Expand Up @@ -107,6 +111,8 @@ function App({
onDayRender={onDayRender}
unavailableDates={unavailableDates}
initialVisibleMonth={initialVisibleMonth}
datepickerPadding={datepickerPadding}
datepickerCloseWrapperRight={datepickerCloseWrapperRight}
/>
)
}
Expand All @@ -121,6 +127,8 @@ storiesOf('Datepicker', module)
showClose={boolean('showClose', true)}
showSelectedDates={boolean('showSelectedDates', true)}
displayFormat={text('displayFormat', 'MM/dd/yyyy')}
datepickerPadding={text('datepickerPadding', '10px')}
datepickerCloseWrapperRight={text('datepickerCloseWrapperRight', '10px')}
/>
))
.add('Initial visible month', () => (
Expand Down
12 changes: 7 additions & 5 deletions packages/styled/src/components/Datepicker/Datepicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ export interface DatepickerProps extends UseDatepickerProps {
datepickerHeight?: string
datepickerLeft?: string
datepickerTop?: string
datepickerZIndex?: number | null
datepickerPadding?: string | null
datepickerCloseWrapperRight?: string | null
}

function Datepicker(
Expand Down Expand Up @@ -189,7 +190,8 @@ function Datepicker(
datepickerHeight = 'unset',
datepickerLeft = '0px',
datepickerTop = '0px',
datepickerZIndex = null,
datepickerPadding = null,
datepickerCloseWrapperRight = null,
}: DatepickerProps,
ref?: React.Ref<unknown>,
) {
Expand Down Expand Up @@ -311,13 +313,13 @@ function Datepicker(
>
<StyledDatepicker
background={theme.datepickerBackground}
p={theme.datepickerPadding}
p={datepickerPadding || theme.datepickerPadding}
borderRadius={datepickerBorderRadius || theme.datepickerBorderRadius}
position={theme.datepickerPosition}
boxShadow={theme.datepickerBoxShadow}
width={theme.datepickerWidth}
height={datepickerHeight}
zIndex={datepickerZIndex || theme.datepickerZIndex}
zIndex={theme.datepickerZIndex}
rtl={rtl}
left={datepickerLeft}
top={datepickerTop}
Expand All @@ -328,7 +330,7 @@ function Datepicker(
display={theme.datepickerCloseWrapperDisplay}
justifyContent={theme.datepickerCloseWrapperJustifyContent}
position={theme.datepickerCloseWrapperPosition}
right={theme.datepickerCloseWrapperRight}
right={datepickerCloseWrapperRight || theme.datepickerCloseWrapperRight}
top={theme.datepickerCloseWrapperTop}
left={theme.datepickerCloseWrapperLeft}
bottom={theme.datepickerCloseWrapperBottom}
Expand Down