Skip to content

Commit

Permalink
feat: support lower-greek list style type prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jsamr committed Jun 4, 2021
1 parent 526e226 commit 3aac2c8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/render-html/src/elements/usePrefixRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ const UpperAlphaPrefixRenderer = ({
);
};

const LowerGreekPrefixRenderer = ({
index,
...props
}: ListPrefixRendererProps) => {
return (
<TextualPrefixRenderer
{...props}
prefix={getStringPrefixFromIndex(index, 0x3b1, 0x3c9) + '.'}
/>
);
};

const NoPrefixRenderer = () => null;

const DecimalPrefixRenderer = ({
Expand Down Expand Up @@ -182,6 +194,11 @@ const upperAlpha: PrefixSpecs = {
computeStrSize: (length) => numOfCharsInPrefix(length, 26)
};

const lowerGreek: PrefixSpecs = {
Component: LowerGreekPrefixRenderer,
computeStrSize: (length) => numOfCharsInPrefix(length, 24)
};

const prefixRenderersMap: Record<SupportedListStyleType, PrefixSpecs> = ({
none,
disc,
Expand All @@ -192,6 +209,7 @@ const prefixRenderersMap: Record<SupportedListStyleType, PrefixSpecs> = ({
'upper-alpha': upperAlpha,
'lower-latin': lowerAlpha,
'upper-latin': upperAlpha,
'lower-greek': lowerGreek,
'decimal-leading-zero': decimalLeadingZero
} as Partial<Record<SupportedListStyleType, PrefixSpecs>>) as Record<
SupportedListStyleType,
Expand Down

0 comments on commit 3aac2c8

Please sign in to comment.