import * as React from 'react'; import ReactTooltip from 'react-tooltip'; import { palette } from '../colors'; import { SparkleOverlay } from '../sparkle'; import { Logomark, Logotype } from './Branding'; import { LogoFlagProps, LogomarkFlag, LogotypeFlag } from './FlagBranding'; type DynamicLogoProps = LogoFlagProps & { currentDate?: Date; }; export const DynamicLogomark = (props: Partial) => { const variant = React.useMemo(() => getRelevantVariant(props.currentDate), [ props.currentDate, ]); if (!variant) { return ; } let tooltipProps = {}; if (variant.tooltip) { tooltipProps = { 'data-tip': variant.tooltip, // 'data-for': 'dynamic-logomark', }; } return ( <> ); }; export const DynamicLogotype = (props: Partial) => { const variant = React.useMemo(() => getRelevantVariant(props.currentDate), [ props.currentDate, ]); if (!variant) { return ; } let tooltipProps = {}; if (variant.tooltip) { tooltipProps = { 'data-tip': variant.tooltip, // 'data-for': 'dynamic-logomark', }; } return ( <> ); }; const getRelevantVariant = (currentDate?: Date) => { for (let variant of AllVariants) { if (variant.activeIf(currentDate)) return variant; } return null; }; // These should be updated for 2021. // Please feel free to update with a PR for 2022 or any missing weeks within 2021. // Rules: // - common law holidays should have at least 2 extra days before and after // - pride days should be 1 extra day before and after // - weeks/months should have no buffer // - 4/20 is just for 4/20. const matchDay = ( start: Date, end: Date, currentDate: Date = new Date(), staticDate: boolean = false ) => { if (!staticDate) { // pre-fill start/end years to simplify start.setFullYear(currentDate.getFullYear()); end.setFullYear(currentDate.getFullYear()); } start.setHours(0, 0, 0, 0); end.setHours(0, 0, 0, 0); if (currentDate > start && currentDate < end) { return true; } return false; }; type Variant = { name: string; activeIf: (currentDate?: Date) => boolean; sharedProps?: Partial; flagStripes?: string[]; tooltip?: string; Logomark: React.FunctionComponent; Logotype: React.FunctionComponent; }; export const Trans: Variant = { // March 31, Nov 13-20+1 name: 'Trans Pride', activeIf: (currentDate?: Date) => matchDay(new Date('2021-Mar-31'), new Date('2021-Apr-1'), currentDate) || matchDay(new Date('2021-Nov-13'), new Date('2021-Nov-22'), currentDate), sharedProps: { circleFill: '#F7A8B8', circleOuterFill: palette.taupe200, typeFill: palette.grey500, stripes: ['#55CDFC', '#F7A8B8', palette.grey600, '#F7A8B8', '#55CDFC'], }, tooltip: 'Roleypoly says trans rights!', Logomark: (props: DynamicLogoProps) => ( ), Logotype: (props: DynamicLogoProps) => ( ), }; export const Bi: Variant = { // Sept 16-23 name: 'Bi Week', activeIf: (currentDate?: Date) => matchDay(new Date('2021-Sep-16'), new Date('2021-Sep-24'), currentDate), sharedProps: { circleFill: '#D60270', circleOuterFill: palette.taupe200, typeFill: '#9B4F96', stripes: ['#0038A8', '#0038A8', '#9B4F96', '#D60270', '#D60270'], }, tooltip: 'Being bi is a lot like a riding a bicycle since they can go both ways.', Logomark: (props: DynamicLogoProps) => , Logotype: (props: DynamicLogoProps) => , }; export const Lesbian: Variant = { // Apr 26 name: 'Lesbian Pride', activeIf: (currentDate?: Date) => matchDay(new Date('2021-Apr-25'), new Date('2021-Apt-27'), currentDate), sharedProps: { circleFill: '#D362A4', circleOuterFill: palette.taupe200, typeFill: '#FF9A56', stripes: ['#D52D00', '#FF9A56', palette.grey600, '#D362A4', '#A30262'], }, tooltip: "I'm a lesbiab... lesbiam... Less Bien... Girls.", Logomark: (props: DynamicLogoProps) => ( ), Logotype: (props: DynamicLogoProps) => ( ), }; export const Ace: Variant = { // Oct 24-30 name: 'Ace Week', activeIf: (currentDate?: Date) => matchDay(new Date('2021-Oct-24'), new Date('2021-Oct-31'), currentDate), sharedProps: { circleFill: '#333', circleOuterFill: palette.taupe200, typeFill: '#CCC', stripes: ['#84067C', palette.grey600, '#CCCCCC', palette.grey100], }, tooltip: "Sexualn't", Logomark: (props: DynamicLogoProps) => , Logotype: (props: DynamicLogoProps) => , }; export const Birthday: Variant = { // Jan 15 name: "Roleypoly's Birthday", activeIf: (currentDate?: Date) => matchDay(new Date('2021-Jan-15'), new Date('2021-Jan-16'), currentDate), sharedProps: { circleFill: 'none', circleOuterFill: palette.taupe300, typeFill: palette.taupe500, }, tooltip: '๐ŸŽ‰ HAPPY BIRTHDAY ROLEYPOLY ๐ŸŽ‰', Logomark: (props: DynamicLogoProps) => ( ), Logotype: (props: DynamicLogoProps) => (
), }; export const DevilsLettuce: Variant = { name: 'Meme #1', // Apr 20 activeIf: (currentDate?: Date) => matchDay(new Date('2021-Apr-20'), new Date('2021-Apr-21'), currentDate), sharedProps: { circleFill: palette.green400, circleOuterFill: palette.green200, typeFill: palette.green400, }, tooltip: 'Legalize it.', Logomark: (props: DynamicLogoProps) => ( ), Logotype: (props: DynamicLogoProps) => ( ), }; export const BicycleDay: Variant = { name: 'Meme #2', // Apr 19 // TODO: hexagon is bestagon activeIf: (currentDate?: Date) => matchDay(new Date('2021-Apr-19'), new Date('2021-Apr-20'), currentDate), sharedProps: { circleFill: palette.gold400, circleOuterFill: palette.taupe200, typeFill: palette.discord400, stripes: Object.values(palette), }, tooltip: 'It increases brain complexity.', Logomark: (props: DynamicLogoProps) => ( ), Logotype: (props: DynamicLogoProps) => ( ), }; export const Christmas: Variant = { name: 'Christmas!', // Dec 20-27 activeIf: (currentDate?: Date) => matchDay(new Date('2021-Dec-20'), new Date('2021-Dec-28'), currentDate), sharedProps: { circleFill: palette.green200, circleOuterFill: palette.red200, typeFill: palette.green400, stripes: [ palette.grey600, palette.red400, palette.grey600, palette.green400, palette.grey600, palette.red400, palette.grey600, palette.green400, palette.grey600, palette.red400, palette.grey600, ], }, tooltip: 'Have yourself a merry little Christmas~', Logomark: (props: DynamicLogoProps) => ( ), Logotype: (props: DynamicLogoProps) => ( ), }; export const NewYear: Variant = { name: "New Year's Day", // Dec 30 - Jan 2 // TODO: sparkle activeIf: (currentDate?: Date) => matchDay(new Date('2021-Dec-30'), new Date('2021-Jan-3'), currentDate), sharedProps: { circleFill: '#222', circleOuterFill: palette.red400, typeFill: '#aaa', }, tooltip: 'Fuck 2020. ๐ŸŽ†๐ŸŽ‡๐ŸŽ†๐ŸŽ‡', Logomark: (props: DynamicLogoProps) => , Logotype: (props: DynamicLogoProps) => (
), }; export const LunarNewYear: Variant = { name: 'Lunar New Year', // Feb 12, 2021 // Feb 1, 2022 activeIf: (currentDate?: Date) => matchDay(new Date('2021-Feb-10'), new Date('2021-Feb-13'), currentDate, true) || matchDay(new Date('2022-Jan-30'), new Date('2022-Feb-3'), currentDate, true), sharedProps: { circleFill: palette.red200, circleOuterFill: palette.gold400, typeFill: palette.taupe300, }, tooltip: 'ๆญๅ–œๅ‘่ดข! ๐ŸŽŠ๐ŸŽ†๐ŸŽ‡', Logomark: (props: DynamicLogoProps) => ( ), Logotype: (props: DynamicLogoProps) => (
), }; export const Pride: Variant = { name: 'LGBTQPOC Pride Month', // June activeIf: (currentDate?: Date) => matchDay(new Date('2021-Jun-1'), new Date('2021-Jul-1'), currentDate), sharedProps: { circleOuterFill: palette.taupe200, typeFill: palette.grey500, stripes: [ '#593BB5', '#26B186', '#FFC468', '#F97C21', '#F62C8B', '#8B5950', '#2D3234', ], }, tooltip: 'LOVE WINS. ๐Ÿ’–๐ŸŒˆ๐ŸŒŸ', Logomark: (props: DynamicLogoProps) => ( ), Logotype: (props: DynamicLogoProps) => ( ), }; export const AllVariants: Variant[] = [ Trans, Pride, Bi, Lesbian, Ace, Birthday, DevilsLettuce, BicycleDay, Christmas, NewYear, LunarNewYear, ];