From 09b7f0b9970b0651b21f01eed0ee7bcba90d932c Mon Sep 17 00:00:00 2001 From: Astrian Zheng Date: Thu, 20 Feb 2025 09:52:45 +1100 Subject: [PATCH] feat: add mainColor prop to SingleDatePicker and replace arrow icons with inline SVGs --- playground/app.tsx | 1 + src/assets/icons/left-arrow.svg | 1 - src/assets/icons/right-arrow.svg | 1 - src/components/SingleDatePicker.tsx | 10 ++++------ 4 files changed, 5 insertions(+), 8 deletions(-) delete mode 100644 src/assets/icons/left-arrow.svg delete mode 100644 src/assets/icons/right-arrow.svg diff --git a/playground/app.tsx b/playground/app.tsx index c26d28d..fc10d0a 100644 --- a/playground/app.tsx +++ b/playground/app.tsx @@ -20,6 +20,7 @@ export default () => { onSelect={onSelect} localization="zh-CN" onClose={() => alert('close')} + mainColor='#ff0000' /> ) diff --git a/src/assets/icons/left-arrow.svg b/src/assets/icons/left-arrow.svg deleted file mode 100644 index eb6c6cc..0000000 --- a/src/assets/icons/left-arrow.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/assets/icons/right-arrow.svg b/src/assets/icons/right-arrow.svg deleted file mode 100644 index c9e49b1..0000000 --- a/src/assets/icons/right-arrow.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/components/SingleDatePicker.tsx b/src/components/SingleDatePicker.tsx index debefa5..c76e332 100644 --- a/src/components/SingleDatePicker.tsx +++ b/src/components/SingleDatePicker.tsx @@ -1,5 +1,3 @@ -import LeftArrowIcon from '@/assets/icons/left-arrow.svg' -import RightArrowIcon from '@/assets/icons/right-arrow.svg' import { useEffect, useState } from 'react' import { getCalendarDates, getL10Weekday, generateUniqueId, applyColor } from '../utils' @@ -155,7 +153,7 @@ export default ({ value, onSelect, localization, onClose, mainColor = '#000000', + }} aria-label={`Go to last year, ${currentYear - 1}, you are now at year ${currentYear}`}> setCurrentYear(parseInt(e.target.value))} @@ -164,7 +162,7 @@ export default ({ value, onSelect, localization, onClose, mainColor = '#000000', + }} aria-label={`Go to next year, ${currentYear + 1}, you are now at year ${currentYear}`}>
{Array.from({ length: 12 }).map((_, index) => + - +
{l10nDays.map((day, index) =>
{day}
)}