Skip to content

Commit

Permalink
feat: remove/replace flag emojis on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
martapanc committed Feb 16, 2024
1 parent fd78879 commit 7ac77fb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
3 changes: 1 addition & 2 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
// TODO Add Scope Enum Here
// 'scope-enum': [2, 'always', ['yourscope', 'yourscope']],
'type-enum': [
2,
'always',
Expand All @@ -11,6 +9,7 @@ module.exports = {
'fix',
'docs',
'chore',
'content',
'style',
'refactor',
'ci',
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function SocialLinks() {
function Copyright() {
const year = new Date().getFullYear();

return <div className='mt-10 flex md:mt-0'>© {year} Marta Pancaldi</div>;
return <div className='mt-10 flex md:mt-0'>© {year} ~ Marta Pancaldi</div>;
}

type FooterLink = {
Expand Down
17 changes: 16 additions & 1 deletion src/components/pages/recruiters-page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
'use client';

import * as React from 'react';
import ReactMarkdown from 'react-markdown';
import rehypeRaw from 'rehype-raw';

import styles from '@/styles/modules/recruiters.module.css';

import clsxm from '@/lib/clsxm';
import { isWindowsOS } from '@/lib/helper';

import Heading from '@/components/atoms/headings/Heading';
import { SalaryHappinessTool } from '@/components/molecules/RecruiterInfo/SalaryHappinessTool';
Expand All @@ -16,6 +19,16 @@ type RecruitersPageProps = {
recruitersData: MarkdownData;
};

function removeFlagEmojisIfWindowsOS(inputText: string): string {
if (typeof window !== 'undefined' && isWindowsOS(window.navigator)) {
return inputText
.replaceAll('🇪🇺', ' ')
.replaceAll('🇮🇹', '🍕')
.replaceAll('🇬🇧', ' ');
}
return inputText;
}

export default function RecruitersPage({
recruitersData,
}: RecruitersPageProps) {
Expand Down Expand Up @@ -49,7 +62,9 @@ export default function RecruitersPage({
className={clsxm(styles['recruiters-info'], 'mb-4')}
rehypePlugins={[rehypeRaw]}
>
{recruitersData.markdownSections[1].content}
{removeFlagEmojisIfWindowsOS(
recruitersData.markdownSections[1].content,
)}
</ReactMarkdown>

<hr />
Expand Down
4 changes: 4 additions & 0 deletions src/lib/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,7 @@ export function shuffleArray<T>(array: T[]): T[] {
}
return shuffledArray;
}

export function isWindowsOS(navigator: Navigator): boolean {
return navigator.userAgent.indexOf('Win') !== -1;
}

0 comments on commit 7ac77fb

Please sign in to comment.