diff --git a/src/features/greeting/Greeting.jsx b/src/features/greeting/Greeting.jsx index dfb6070b..32275b92 100644 --- a/src/features/greeting/Greeting.jsx +++ b/src/features/greeting/Greeting.jsx @@ -1,7 +1,7 @@ import variables from 'config/variables'; import { useRef, useState, useEffect } from 'react'; -import { nth, convertTimezone } from 'utils/date'; +import { appendNth, convertTimezone } from 'utils/date'; import EventBus from 'utils/eventbus'; import defaults from './options/default'; @@ -107,7 +107,7 @@ function Greeting() { if (birth.getDate() === now.getDate() && birth.getMonth() === now.getMonth()) { if (localStorage.getItem('birthdayage') === 'true' && calculateAge(birth) !== 0) { const text = variables.getMessage('widgets.greeting.birthday').split(' '); - message = `${text[0]} ${nth(calculateAge(birth))} ${text[1]}`; + message = `${text[0]} ${appendNth(calculateAge(birth))} ${text[1]}`; } else { message = variables.getMessage('widgets.greeting.birthday'); } diff --git a/src/features/time/Date.jsx b/src/features/time/Date.jsx index 31b95308..ad284bb3 100644 --- a/src/features/time/Date.jsx +++ b/src/features/time/Date.jsx @@ -1,7 +1,7 @@ import variables from 'config/variables'; import { useState, useEffect, useRef, useCallback } from 'react'; -import { nth, convertTimezone } from 'utils/date'; +import { appendNth, convertTimezone } from 'utils/date'; import EventBus from 'utils/eventbus'; import defaults from './options/default'; @@ -98,7 +98,7 @@ const DateWidget = () => { const datenth = localStorage.getItem('datenth') === 'true' - ? nth(currentDate.getDate()) + ? appendNth(currentDate.getDate()) : currentDate.getDate(); const dateDay = diff --git a/src/scss/_error.scss b/src/scss/_error.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/src/scss/_mobile.scss b/src/scss/_mobile.scss deleted file mode 100644 index 49fb310a..00000000 --- a/src/scss/_mobile.scss +++ /dev/null @@ -1,19 +0,0 @@ -.mobile { - .navbar { - flex-flow: column; - } - - .searchComponents { - display: none; - } - - #modal { - // fill screen - width: 100vw; - height: 100vh; - } - - .modalSidebar { - display: none; - } -} diff --git a/src/scss/index.scss b/src/scss/index.scss index 6e67152f..0a0bf64c 100644 --- a/src/scss/index.scss +++ b/src/scss/index.scss @@ -1,5 +1,6 @@ @import 'variables'; @import 'toast'; + @tailwind base; @tailwind components; @tailwind utilities; diff --git a/src/utils/date/convertTimezone.js b/src/utils/date/convertTimezone.js new file mode 100644 index 00000000..8acfc33d --- /dev/null +++ b/src/utils/date/convertTimezone.js @@ -0,0 +1,13 @@ +/** + * It takes a date and a timezone and returns a new date object with the timezone applied. + * @param date - The date you want to convert. + * @param tz - The timezone you want to convert to. + * @returns A new Date object with the timezone set to the timezone passed in. + */ +export function convertTimezone(date, tz) { + return new Date( + (typeof date === 'string' ? new Date(date) : date).toLocaleString('en-US', { + timeZone: tz, + }), + ); +} diff --git a/src/utils/date/getNth.js b/src/utils/date/getNth.js new file mode 100644 index 00000000..0f7cf6e2 --- /dev/null +++ b/src/utils/date/getNth.js @@ -0,0 +1,22 @@ +/** + * If the number is between 3 and 20, return the number with the suffix "th". Otherwise, return the + * number with the suffix "st", "nd", "rd", or "th" depending on the last digit of the number + * @param d - The day of the month. + * @returns the day of the month with the appropriate suffix. + */ +export function appendNth(d) { + if (d > 3 && d < 21) { + return d + 'th'; + } + + switch (d % 10) { + case 1: + return d + 'st'; + case 2: + return d + 'nd'; + case 3: + return d + 'rd'; + default: + return d + 'th'; + } +} diff --git a/src/utils/date/index.js b/src/utils/date/index.js index 9dd48fc2..ddb70924 100644 --- a/src/utils/date/index.js +++ b/src/utils/date/index.js @@ -1,37 +1,4 @@ -// todo: maybe move stuff -/** - * If the number is between 3 and 20, return the number with the suffix "th". Otherwise, return the - * number with the suffix "st", "nd", "rd", or "th" depending on the last digit of the number - * @param d - The day of the month. - * @returns the day of the month with the appropriate suffix. - */ -export function nth(d) { - if (d > 3 && d < 21) { - return d + 'th'; - } +import { convertTimezone } from './convertTimezone'; +import { getNth } from './getNth'; - switch (d % 10) { - case 1: - return d + 'st'; - case 2: - return d + 'nd'; - case 3: - return d + 'rd'; - default: - return d + 'th'; - } -} - -/** - * It takes a date and a timezone and returns a new date object with the timezone applied. - * @param date - The date you want to convert. - * @param tz - The timezone you want to convert to. - * @returns A new Date object with the timezone set to the timezone passed in. - */ -export function convertTimezone(date, tz) { - return new Date( - (typeof date === 'string' ? new Date(date) : date).toLocaleString('en-US', { - timeZone: tz, - }), - ); -} +export { convertTimezone, getNth }; diff --git a/tailwind.config.js b/tailwind.config.js index f38122ef..4204ba49 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -33,13 +33,13 @@ module.exports = { DEFAULT: '12px', }, borderColor: { - modal: 'rgba(14, 16, 19, 0.3)', // Define your custom border color + modal: 'rgba(14, 16, 19, 0.3)', }, textShadow: { sm: '0 1px 4px var(--tw-shadow-color)', DEFAULT: '0 2px 8px var(--tw-shadow-color)', lg: '0 8px 24px var(--tw-shadow-color)', - }, + } }, }, plugins: [