Skip to content

Commit

Permalink
Merge pull request #67 from josippapez/fix/links
Browse files Browse the repository at this point in the history
Fix - Links
  • Loading branch information
josippapez authored Aug 14, 2024
2 parents 038c6e6 + 3252dcd commit 90f69f6
Show file tree
Hide file tree
Showing 14 changed files with 152 additions and 91 deletions.
1 change: 0 additions & 1 deletion modules/PDFView/CVTemplates/CVTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ interface Props {
template: Template;
skills: Skill[];
projects: Project[];
isHtml?: boolean;
}

interface OptionType extends Props {
Expand Down
16 changes: 10 additions & 6 deletions modules/PDFView/CVTemplates/Images/Earth.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import {
G,
Path,
Svg,
} from '@rawwee/react-pdf-html';
import { G, Path, Svg } from '@rawwee/react-pdf-html';

export const Earth = (props: { width?: number; height?: number }) => {
const { width, height } = props;
return (
<Svg viewBox='0 0 82.51 82.51' width={width} height={height}>
<Svg
viewBox='0 0 82.51 82.51'
width={width}
height={height}
style={{
minWidth: width,
minHeight: height,
}}
>
<G>
<Path
fill='white'
Expand Down
10 changes: 9 additions & 1 deletion modules/PDFView/CVTemplates/Images/Email.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ import { G, Path, Svg } from '@rawwee/react-pdf-html';
export const Email = (props: { width?: number; height?: number }) => {
const { width, height } = props;
return (
<Svg viewBox='0 0 75.294 75.294' width={width} height={height}>
<Svg
viewBox='0 0 75.294 75.294'
width={width}
height={height}
style={{
minWidth: width,
minHeight: height,
}}
>
<G>
<Path
fill='white'
Expand Down
16 changes: 10 additions & 6 deletions modules/PDFView/CVTemplates/Images/Facebook.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import {
G,
Path,
Svg,
} from '@rawwee/react-pdf-html';
import { G, Path, Svg } from '@rawwee/react-pdf-html';

export const Facebook = (props: { width?: number; height?: number }) => {
const { width, height } = props;
return (
<Svg viewBox='0 0 310 310' width={width} height={height}>
<Svg
viewBox='0 0 310 310'
width={width}
height={height}
style={{
minWidth: width,
minHeight: height,
}}
>
<G>
<Path
fill='white'
Expand Down
16 changes: 10 additions & 6 deletions modules/PDFView/CVTemplates/Images/Github.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import {
G,
Path,
Svg,
} from '@rawwee/react-pdf-html';
import { G, Path, Svg } from '@rawwee/react-pdf-html';

export const GitHub = (props: { width?: number; height?: number }) => {
const { width, height } = props;
return (
<Svg viewBox='0 0 24 24' width={width} height={height}>
<Svg
viewBox='0 0 24 24'
width={width}
height={height}
style={{
minWidth: width,
minHeight: height,
}}
>
<G>
<Path
stroke='white'
Expand Down
16 changes: 10 additions & 6 deletions modules/PDFView/CVTemplates/Images/Linkedin.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import {
G,
Path,
Svg,
} from '@rawwee/react-pdf-html';
import { G, Path, Svg } from '@rawwee/react-pdf-html';

export const Linkedin = (props: { width?: number; height?: number }) => {
const { width, height } = props;
return (
<Svg viewBox='0 0 45.959 45.959' width={width} height={height}>
<Svg
viewBox='0 0 45.959 45.959'
width={width}
height={height}
style={{
minWidth: width,
minHeight: height,
}}
>
<G>
<Path
fill='white'
Expand Down
17 changes: 10 additions & 7 deletions modules/PDFView/CVTemplates/Images/Phone.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import {
G,
Path,
Rect,
Svg,
} from '@rawwee/react-pdf-html';
import { G, Path, Rect, Svg } from '@rawwee/react-pdf-html';

export const Phone = (props: { width?: number; height?: number }) => {
const { width, height } = props;
return (
<Svg viewBox='0 0 100.891 100.891' width={width} height={height}>
<Svg
viewBox='0 0 100.891 100.891'
width={width}
height={height}
style={{
minWidth: width,
minHeight: height,
}}
>
<G>
<Path
fill='white'
Expand Down
16 changes: 10 additions & 6 deletions modules/PDFView/CVTemplates/Images/Pin.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import {
G,
Path,
Svg,
} from '@rawwee/react-pdf-html';
import { G, Path, Svg } from '@rawwee/react-pdf-html';

export const Pin = (props: { width?: number; height?: number }) => {
const { width, height } = props;
return (
<Svg width={width} height={height} viewBox='0 0 68.634 68.634'>
<Svg
width={width}
height={height}
viewBox='0 0 68.634 68.634'
style={{
minWidth: width,
minHeight: height,
}}
>
<G>
<Path
fill='white'
Expand Down
16 changes: 10 additions & 6 deletions modules/PDFView/CVTemplates/Images/Twitter.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import {
G,
Path,
Svg,
} from '@rawwee/react-pdf-html';
import { G, Path, Svg } from '@rawwee/react-pdf-html';

export const Twitter = (props: { width?: number; height?: number }) => {
const { width, height } = props;
return (
<Svg viewBox='0 0 512 512' width={width} height={height}>
<Svg
viewBox='0 0 512 512'
width={width}
height={height}
style={{
minWidth: width,
minHeight: height,
}}
>
<G>
<Path
fill='white'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const additionalInfoStyles = StyleSheet.create({
display: 'flex',
flexDirection: 'column',
rowGap: 10,
width: '100%',
},
iconWrapper: {
display: 'flex',
Expand Down Expand Up @@ -123,9 +124,17 @@ export const AdditionalInformation: FC<Props> = ({
return condition;
})
.map(({ icon, text, link }, index) => {
let url = null;

try {
if (link) url = new URL(link ?? '')?.toString();
} catch (error) {
console.error(error);
}

const LinkDisplay = () => (
<Link
src={link || `mailto:${text}`}
src={link ?? `mailto:${text}`}
style={[additionalInfoStyles.iconsDisplay]}
>
{icon({ width: 14 })}
Expand All @@ -137,25 +146,23 @@ export const AdditionalInformation: FC<Props> = ({
) : (
<View key={`additionalInfo-${index}`} style={itemWrapperStyle}>
{icon({ width: 14 })}
{text && <Text style={styles.additionalInfoBarText}>{text}</Text>}
{link && (
<Link
src={link}
style={{
textDecoration: 'none',
}}
>
<Text style={styles.additionalInfoBarText}>
{decodeURIComponent(
<Link
src={url ?? `mailto:${text}`}
style={{
textDecoration: 'none',
}}
>
<Text style={styles.additionalInfoBarText}>
{link &&
decodeURIComponent(
link
.replace(/(^\w+:|^)\/\//, '')
.replace(/(^www\.)/, '')
.replace(/(linkedin|github).com\//, '')
.replace(/(in)\//, '')
).replace(/\/$/, '')}
</Text>
</Link>
)}
{text}
</Text>
</Link>
</View>
);
});
Expand All @@ -178,10 +185,16 @@ export const AdditionalInformation: FC<Props> = ({
backgroundColor,
}}
>
<View style={[additionalInfoStyles.infoDisplay, wrapperStyle, {
justifyContent: 'flex-start',
gap: '100px',
}]}>
<View
style={[
additionalInfoStyles.infoDisplay,
wrapperStyle,
{
justifyContent: 'flex-start',
gap: '100px',
},
]}
>
<View style={additionalInfoStyles.infoWrapper}>{firstHalf}</View>
<View style={additionalInfoStyles.infoWrapper}>{secondHalf}</View>
</View>
Expand Down
18 changes: 15 additions & 3 deletions modules/PDFView/PDFDownload/PDFDownload.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import { Dialog, DialogContent } from '@/components/ui/dialog';
import {
Dialog,
DialogContent,
DialogDescription,
DialogTitle,
} from '@/components/ui/dialog';
import { getCurrentTranslations } from '@/translations/hooks/getCurrentTranslations';
import { DEFAULT_LOCALE } from '@/translations/locales';
import { usePDFComponentsAreHTML } from '@rawwee/react-pdf-html';
import ReactPDF, { PDFDownloadLink } from '@react-pdf/renderer';
import { PDFDownloadLink, UsePDFInstance } from '@react-pdf/renderer';
import { NextIntlClientProvider, useLocale } from 'next-intl';
import { useEffect, useState } from 'react';

type Props = {
PdfInstance?: () => JSX.Element;
pdfBlob?: ReactPDF.UsePDFInstance;
pdfBlob?: UsePDFInstance;
closeModal(): void;
show: boolean;
};
Expand Down Expand Up @@ -39,11 +44,18 @@ export const PDFDownload = ({
setMessages(messages);
});
}

return () => {
setHtml(true);
setDownload(false);
};
}, [show]);

return (
<Dialog open={show} onOpenChange={closeModal}>
<DialogContent showCloseButton={false}>
<DialogTitle hidden>Download CV</DialogTitle>
<DialogDescription hidden>Download CV</DialogDescription>
<div className='relative h-fit w-fit flex-col bg-white p-5 text-almost-black'>
<div className='flex items-center justify-between'>
<h1 className='text-2xl font-bold'>Download CV</h1>
Expand Down
34 changes: 17 additions & 17 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,23 @@ const nextConfig = {
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: 'asset/resource',
});
config.plugins.push(
new CopyPlugin({
patterns: [
{
from: path.join('./', 'node_modules/pdfjs-dist/cmaps'),
to: path.join('./', 'public/cmaps'),
},
{
from: path.join(
'./',
'node_modules/pdfjs-dist/build/pdf.worker.min.js'
),
to: path.join('./', 'public'),
},
],
})
);
// config.plugins.push(
// new CopyPlugin({
// patterns: [
// {
// from: path.join('./', 'node_modules/pdfjs-dist/cmaps'),
// to: path.join('./', 'public/cmaps'),
// },
// {
// from: path.join(
// './',
// 'node_modules/pdfjs-dist/build/pdf.worker.min.js'
// ),
// to: path.join('./', 'public'),
// },
// ],
// })
// );
return config;
},
};
Expand Down
14 changes: 8 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

1 comment on commit 90f69f6

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for cv-maker ready!

✅ Preview
https://cv-maker-pjo3eyl6y-josippapezs-projects.vercel.app

Built with commit 90f69f6.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.