mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-15 11:00:47 +02:00
# Description of Changes <!-- Please provide a summary of the changes, including: - What was changed - Why the change was made - Any challenges encountered Closes #(issue_number) --> --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details. --------- Co-authored-by: James Brunton <[email protected]>
114 lines
3.3 KiB
TypeScript
114 lines
3.3 KiB
TypeScript
import { Flex } from '@mantine/core';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { useCookieConsent } from '@app/hooks/useCookieConsent';
|
|
|
|
interface FooterProps {
|
|
privacyPolicy?: string;
|
|
termsAndConditions?: string;
|
|
accessibilityStatement?: string;
|
|
cookiePolicy?: string;
|
|
impressum?: string;
|
|
analyticsEnabled?: boolean;
|
|
}
|
|
|
|
export default function Footer({
|
|
privacyPolicy,
|
|
termsAndConditions,
|
|
accessibilityStatement,
|
|
cookiePolicy,
|
|
impressum,
|
|
analyticsEnabled = false
|
|
}: FooterProps) {
|
|
const { t } = useTranslation();
|
|
const { showCookiePreferences } = useCookieConsent({ analyticsEnabled });
|
|
|
|
// Helper to check if a value is valid (not null/undefined/empty string)
|
|
const isValidLink = (link?: string) => link && link.trim().length > 0;
|
|
|
|
return (
|
|
<div style={{
|
|
height: 'var(--footer-height)',
|
|
backgroundColor: 'var(--mantine-color-gray-1)',
|
|
borderTop: '1px solid var(--mantine-color-gray-2)',
|
|
display: 'flex',
|
|
flexDirection: 'column',
|
|
justifyContent: 'center',
|
|
}}>
|
|
<Flex gap="md"
|
|
justify="center"
|
|
align="center"
|
|
direction="row"
|
|
style={{ fontSize: '0.75rem' }}>
|
|
<a
|
|
className="footer-link px-3"
|
|
id="survey"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
href="https://stirlingpdf.info/s/cm28y3niq000o56dv7liv8wsu"
|
|
>
|
|
{t('survey.nav', 'Survey')}
|
|
</a>
|
|
{isValidLink(privacyPolicy) && (
|
|
<a
|
|
className="footer-link px-3"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
href={privacyPolicy}
|
|
>
|
|
{t('legal.privacy', 'Privacy Policy')}
|
|
</a>
|
|
)}
|
|
{isValidLink(termsAndConditions) && (
|
|
<a
|
|
className="footer-link px-3"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
href={termsAndConditions}
|
|
>
|
|
{t('legal.terms', 'Terms and Conditions')}
|
|
</a>
|
|
)}
|
|
{isValidLink(accessibilityStatement) && (
|
|
<a
|
|
className="footer-link px-3"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
href={accessibilityStatement}
|
|
>
|
|
{t('legal.accessibility', 'Accessibility')}
|
|
</a>
|
|
)}
|
|
{isValidLink(cookiePolicy) && (
|
|
<a
|
|
className="footer-link px-3"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
href={cookiePolicy}
|
|
>
|
|
{t('legal.cookie', 'Cookie Policy')}
|
|
</a>
|
|
)}
|
|
{isValidLink(impressum) && (
|
|
<a
|
|
className="footer-link px-3"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
href={impressum}
|
|
>
|
|
{t('legal.impressum', 'Impressum')}
|
|
</a>
|
|
)}
|
|
{analyticsEnabled && (
|
|
<button
|
|
className="footer-link px-3"
|
|
id="cookieBanner"
|
|
onClick={showCookiePreferences}
|
|
>
|
|
{t('legal.showCookieBanner', 'Cookie Preferences')}
|
|
</button>
|
|
)}
|
|
</Flex>
|
|
</div>
|
|
);
|
|
}
|