mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-24 17:03:55 +10:00
feat: update links for improved accessibility
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
"#react-pdf-renderer": "@react-pdf/renderer"
|
||||
},
|
||||
"scripts": {
|
||||
"doctor": "react-doctor",
|
||||
"typecheck": "tsgo --noEmit",
|
||||
"test": "vitest run --passWithNoTests",
|
||||
"test:coverage": "vitest run --coverage --passWithNoTests",
|
||||
@@ -38,6 +39,7 @@
|
||||
"@reactive-resume/config": "workspace:*",
|
||||
"@types/react": "^19.2.15",
|
||||
"@typescript/native-preview": "7.0.0-dev.20260526.1",
|
||||
"react-doctor": "^0.2.6",
|
||||
"typescript": "^6.0.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ResumeData } from "@reactive-resume/schema/resume/data";
|
||||
import type { ReactNode } from "react";
|
||||
import type { SectionTitleResolver } from "./section-title";
|
||||
import { createContext, use } from "react";
|
||||
import { createContext, use, useMemo } from "react";
|
||||
import { isRTL } from "@reactive-resume/utils/locale";
|
||||
|
||||
type RenderContextValue = ResumeData & {
|
||||
@@ -19,8 +19,12 @@ export type RenderProviderProps = {
|
||||
|
||||
export const RenderProvider = ({ data, resolveSectionTitle, children }: RenderProviderProps) => {
|
||||
const rtl = isRTL(data.metadata.page.locale);
|
||||
const contextValue = useMemo<RenderContextValue>(
|
||||
() => ({ ...data, resolveSectionTitle, rtl }),
|
||||
[data, resolveSectionTitle, rtl],
|
||||
);
|
||||
|
||||
return <RenderContext.Provider value={{ ...data, resolveSectionTitle, rtl }}>{children}</RenderContext.Provider>;
|
||||
return <RenderContext.Provider value={contextValue}>{children}</RenderContext.Provider>;
|
||||
};
|
||||
|
||||
export const useRender = (): RenderContextValue => {
|
||||
|
||||
@@ -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