@shopgate/engage
Version:
Shopgate's ENGAGE library.
38 lines (37 loc) • 1.02 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import { i18n } from "../../../core";
import { openingHoursRow, openingHoursDay } from "./Store.style";
/**
* Renders a single opening hours line.
* @param {Object} props The component props.
* @param {string} props.day The day.
* @param {string} props.hours The hours line.
* @returns {JSX.Element}
*/
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export function StoreOpeningHoursLine({
day,
hours
}) {
if (!hours || hours === '') {
return null;
}
return /*#__PURE__*/_jsxs("tr", {
className: openingHoursRow,
"aria-label": `${i18n.text(`locations.${day}`)}: ${hours}`,
tabIndex: 0,
role: "row",
children: [/*#__PURE__*/_jsx("td", {
className: openingHoursDay,
"aria-hidden": true,
children: i18n.text(`locations.${day}`)
}), /*#__PURE__*/_jsx("td", {
"aria-hidden": true,
children: hours
})]
});
}
StoreOpeningHoursLine.defaultProps = {
hours: null
};