mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-25 17:34:52 +10:00
feat: update links for improved accessibility
This commit is contained in:
@@ -10,7 +10,7 @@ import type {
|
||||
TemplateStyleSlot,
|
||||
TemplateStyleSlots,
|
||||
} from "./types";
|
||||
import { createContext, use } from "react";
|
||||
import { createContext, use, useMemo } from "react";
|
||||
|
||||
type TemplateContextValue = {
|
||||
styles: TemplateStyleSlots;
|
||||
@@ -60,9 +60,12 @@ export const TemplateProvider = ({
|
||||
features = EMPTY_FEATURES,
|
||||
children,
|
||||
}: TemplateProviderProps) => {
|
||||
return (
|
||||
<TemplateContext.Provider value={{ styles, featureStyles, colors, features }}>{children}</TemplateContext.Provider>
|
||||
const contextValue = useMemo<TemplateContextValue>(
|
||||
() => ({ styles, featureStyles, colors, features }),
|
||||
[colors, featureStyles, features, styles],
|
||||
);
|
||||
|
||||
return <TemplateContext.Provider value={contextValue}>{children}</TemplateContext.Provider>;
|
||||
};
|
||||
|
||||
export const TemplatePlacementProvider = ({
|
||||
|
||||
@@ -4,17 +4,11 @@ import type { StyleInput } from "./styles";
|
||||
import { Icon as PhosphorIcon } from "phosphor-icons-react-pdf/dynamic";
|
||||
import { Link as PdfLink, Text as PdfText, View } from "../../renderer";
|
||||
import { useTemplateIconSlot, useTemplateStyle } from "./context";
|
||||
import { safeTextStyle } from "./safe-text-style";
|
||||
import { composeLinkStyles, composeStyles } from "./styles";
|
||||
|
||||
const asStyleInput = (style: unknown): StyleInput => style as StyleInput;
|
||||
|
||||
export const safeTextStyle = {
|
||||
minWidth: 0,
|
||||
maxWidth: "100%",
|
||||
flexShrink: 1,
|
||||
overflow: "hidden",
|
||||
} satisfies Style;
|
||||
|
||||
export const Div = ({ style, ...props }: ComponentProps<typeof View>) => {
|
||||
const divStyle = useTemplateStyle("div");
|
||||
|
||||
|
||||
@@ -72,9 +72,11 @@ const tryConvertPseudoBulletParagraph = (paragraphInnerHtml: string): string | n
|
||||
const cleaned = stripEmptyInlineWrappers(paragraphInnerHtml);
|
||||
if (!/<br\b/i.test(cleaned)) return null;
|
||||
|
||||
const segments = splitByBreaks(cleaned)
|
||||
.map((segment) => segment.trim())
|
||||
.filter((segment) => segment.length > 0);
|
||||
const segments: string[] = [];
|
||||
for (const segment of splitByBreaks(cleaned)) {
|
||||
const trimmed = segment.trim();
|
||||
if (trimmed.length > 0) segments.push(trimmed);
|
||||
}
|
||||
|
||||
if (segments.length < 2) return null;
|
||||
if (!segments.every((segment) => PSEUDO_BULLET_LEAD.test(segment))) return null;
|
||||
|
||||
@@ -5,7 +5,6 @@ import { Html } from "react-pdf-html";
|
||||
import { useRender } from "../../context";
|
||||
import { Text as PdfText, View } from "../../renderer";
|
||||
import { useTemplateStyle } from "./context";
|
||||
import { safeTextStyle } from "./primitives";
|
||||
import { convertPseudoBulletParagraphs, normalizeRichTextHtml, richTextMarkClassName } from "./rich-text-html";
|
||||
import { renderRichTextParagraph, toRichTextStyleArray } from "./rich-text-renderers";
|
||||
import {
|
||||
@@ -15,6 +14,7 @@ import {
|
||||
resolveRichTextBodyLineHeight,
|
||||
stripRichTextVerticalMargins,
|
||||
} from "./rich-text-spacing";
|
||||
import { safeTextStyle } from "./safe-text-style";
|
||||
import { composeStyles, mergeLinkStyles, mergeStyles } from "./styles";
|
||||
|
||||
const richListItemContentStackStyle = {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { Style } from "@react-pdf/types";
|
||||
|
||||
export const safeTextStyle = {
|
||||
minWidth: 0,
|
||||
maxWidth: "100%",
|
||||
flexShrink: 1,
|
||||
overflow: "hidden",
|
||||
} satisfies Style;
|
||||
Reference in New Issue
Block a user