Skip to content

Commit 412e5b3

Browse files
committed
Minor type fix for FitText and enhance examples to use sub-components.
1 parent 9f64d9b commit 412e5b3

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

examples/js/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ const Presentation = () => (
142142
<Slide>
143143
<Heading>This is a Heading</Heading>
144144
<FitText>
145-
This is a <code>FitText</code> component
145+
This is a <CodeSpan>FitText</CodeSpan> component
146146
</FitText>
147147
<FitText
148148
color="secondary"

examples/one-page/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
</${Slide}>
174174
<${Slide}>
175175
<${Heading}>This is a Heading</${Heading}>
176-
<${FitText}>This is a <code>FitText</code> component</${FitText}>
176+
<${FitText}>This is a <${CodeSpan}>FitText</${CodeSpan}> component</${FitText}>
177177
<${FitText} color="secondary" style=${{
178178
textTransform: 'uppercase',
179179
fontFamily: 'Comic Sans MS'

examples/typescript/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ const Presentation = () => (
141141
<Slide>
142142
<Heading>This is a Heading</Heading>
143143
<FitText>
144-
This is a <code>FitText</code> component
144+
This is a <CodeSpan>FitText</CodeSpan> component
145145
</FitText>
146146
<FitText
147147
color="secondary"

packages/spectacle/src/components/typography.tsx

+11-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ import {
1010
SpaceProps,
1111
BorderProps
1212
} from 'styled-system';
13-
import { FC, PropsWithChildren, RefAttributes, useRef, useState } from 'react';
13+
import {
14+
FC,
15+
PropsWithChildren,
16+
RefAttributes,
17+
useRef,
18+
useState,
19+
HTMLAttributes
20+
} from 'react';
1421
import useResizeObserver from 'use-resize-observer';
1522

1623
const decoration = system({ textDecoration: true });
@@ -134,7 +141,9 @@ ScalableText.defaultProps = {
134141
scale: 1
135142
};
136143

137-
const FitText: FC<PropsWithChildren<CommonTypographyProps>> = (props) => {
144+
const FitText: FC<
145+
PropsWithChildren<CommonTypographyProps & HTMLAttributes<HTMLDivElement>>
146+
> = (props) => {
138147
const containerRef = useRef<HTMLDivElement>(null);
139148
const textRef = useRef<HTMLDivElement>(null);
140149
const [scale, setScale] = useState(1);

0 commit comments

Comments
 (0)