Skip to content

Commit

Permalink
Merge pull request #29 from culturecreates/feature/issue-1036
Browse files Browse the repository at this point in the history
Feature/issue 1036
  • Loading branch information
SyamBabu-M authored Mar 27, 2024
2 parents 3088678 + 53b8ef6 commit 6a0060b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
6 changes: 1 addition & 5 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,10 @@

<div
id="calendar-widget"
data-api="api.footlight.io"
data-locale="en"
data-calendar="tout-culture"
data-color="#047857"
data-limit="9"
data-logo="https://cdn.footlight.io/iiif/3/tout-culture-logo.png/0,0,1620,1080/400,/0/default.png"
data-event-url="https://toutculture.ca/en/event-detail/?event="
data-search-events-url="https://toutculture.ca/en/filter-evenements/"
data-api="api.footlight.io"
data-search-events-filter=""
data-height="600px"
></div>
Expand Down
8 changes: 6 additions & 2 deletions src/components/customCalendar/CustomCalendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const CustomCalendar = () => {
setStartDateSpan,
setEndDateSpan,
isSingleDate,
widgetProp,
widgetProps,
displayType,
calendarModalToggle,
setCalendarModalToggle,
Expand Down Expand Up @@ -101,6 +101,10 @@ export const CustomCalendar = () => {
return date.toLocaleDateString(locale, { weekday: 'short' }).charAt(0);
};

useEffect(() => {
console.log(widgetProps?.locale);
}, [widgetProps]);

return (
<div
className="custom-calendar-wrapper"
Expand All @@ -125,7 +129,7 @@ export const CustomCalendar = () => {
selectRange={isSingleDate}
formatShortWeekday={formatShortWeekday}
className="react-calendar-wrapper"
locale={widgetProp?.locale}
locale={widgetProps?.locale}
prevLabel={<img src={prevButton} alt=""></img>}
prev2Label={<img src={prev2Button} alt=""></img>}
next2Label={<img src={next2Button} alt=""></img>}
Expand Down
10 changes: 5 additions & 5 deletions src/components/footer/Footer.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useContext } from 'react';
import React, { useContext, useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import WidgetContext from '../../context/WidgetContext';
import './footer.css';
Expand All @@ -9,11 +9,11 @@ const Footer = () => {
const { widgetProps, searchKeyWord, startDateSpan, endDateSpan, totalCount } =
useContext(WidgetContext);

const { searchEventsUrl, locale } = widgetProps;
const { searchEventsUrl, locale, calendarName } = widgetProps;

const calendarName = widgetProps?.calendar.replace(/(?:^|-)([a-z])/g, (_, group) =>
group.toUpperCase(),
);
useEffect(() => {
console.log(calendarName);
}, [calendarName]);

const submitHandler = (event) => {
event.preventDefault();
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const defaultProps = {
api: calendarWidget.dataset?.api,
locale: calendarWidget.dataset?.locale,
calendar: calendarWidget.dataset?.calendar,
calendarName: calendarWidget.dataset?.calendarName,
color: calendarWidget.dataset?.color,
limit: calendarWidget.dataset?.limit,
calendarLogo: calendarWidget.dataset?.logo,
Expand Down
2 changes: 2 additions & 0 deletions src/utils/extractPropsFromSearchParms.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export function extractPropsFromSearchParams(defaultProps) {
const api = searchParams.get('api') || defaultProps?.api;
const locale = searchParams.get('locale') || defaultProps?.locale;
const calendar = searchParams.get('calendar') || defaultProps?.calendar;
const calendarName = searchParams.get('calendarName') || defaultProps?.calendarName;
const color = searchParams.get('color') || defaultProps?.color;
const limit = searchParams.get('limit') || defaultProps?.limit;
const calendarLogo = searchParams.get('logo') || defaultProps?.calendarLogo;
Expand All @@ -18,6 +19,7 @@ export function extractPropsFromSearchParams(defaultProps) {
api,
locale,
calendar,
calendarName,
color,
limit,
calendarLogo: decodeURIComponent(calendarLogo),
Expand Down

0 comments on commit 6a0060b

Please sign in to comment.