mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-06-22 04:11:55 +10:00
fix(#2978): show underline on all links
This commit is contained in:
@@ -4,7 +4,7 @@ import type { StyleInput } from "./styles";
|
||||
import { Link as PdfLink, Text as PdfText, View } from "@react-pdf/renderer";
|
||||
import { Icon as PhosphorIcon } from "phosphor-icons-react-pdf/dynamic";
|
||||
import { useTemplateIconSlot, useTemplateStyle } from "./context";
|
||||
import { composeStyles } from "./styles";
|
||||
import { composeLinkStyles, composeStyles } from "./styles";
|
||||
|
||||
const asStyleInput = (style: unknown): StyleInput => style as StyleInput;
|
||||
|
||||
@@ -36,7 +36,7 @@ export const Heading = ({ style, ...props }: ComponentProps<typeof PdfText>) =>
|
||||
export const Link = ({ style, ...props }: ComponentProps<typeof PdfLink>) => {
|
||||
const linkStyle = useTemplateStyle("link");
|
||||
|
||||
return <PdfLink style={composeStyles(linkStyle, asStyleInput(style), safeTextStyle)} {...props} />;
|
||||
return <PdfLink style={composeLinkStyles(linkStyle, asStyleInput(style), safeTextStyle)} {...props} />;
|
||||
};
|
||||
|
||||
export const Small = ({ style, ...props }: ComponentProps<typeof PdfText>) => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Text as PdfText, View } from "@react-pdf/renderer";
|
||||
import { Html } from "react-pdf-html";
|
||||
import { useTemplateStyle } from "./context";
|
||||
import { safeTextStyle } from "./primitives";
|
||||
import { composeStyles, mergeStyles } from "./styles";
|
||||
import { composeStyles, mergeLinkStyles, mergeStyles } from "./styles";
|
||||
|
||||
export const RichText = ({ children }: { children: string }) => {
|
||||
const boldStyle = useTemplateStyle("bold");
|
||||
@@ -38,7 +38,7 @@ export const RichText = ({ children }: { children: string }) => {
|
||||
b: mergeStyles(boldStyle, safeTextStyle),
|
||||
strong: mergeStyles(boldStyle, safeTextStyle),
|
||||
p: mergeStyles(richParagraphStyle, safeTextStyle),
|
||||
a: mergeStyles(linkStyle, { textDecoration: "underline" }, safeTextStyle),
|
||||
a: mergeLinkStyles(linkStyle, safeTextStyle),
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -13,8 +13,14 @@ export const composeStyles = (...styles: StyleInput[]): Style[] => {
|
||||
});
|
||||
};
|
||||
|
||||
export const linkUnderlineStyle = { textDecoration: "underline" } satisfies Style;
|
||||
|
||||
export const composeLinkStyles = (...styles: StyleInput[]): Style[] => composeStyles(...styles, linkUnderlineStyle);
|
||||
|
||||
export const mergeStyles = (...styles: StyleInput[]): Style => Object.assign({}, ...composeStyles(...styles));
|
||||
|
||||
export const mergeLinkStyles = (...styles: StyleInput[]): Style => mergeStyles(...styles, linkUnderlineStyle);
|
||||
|
||||
export type ResolvePlacementColorOptions = {
|
||||
placement: TemplatePlacement;
|
||||
defaultForeground: string;
|
||||
|
||||
Reference in New Issue
Block a user