datchley / react-scale-text

A React library to keep an element's text scaled to fit it's container
MIT License
54 stars 18 forks source link

Needs typescript definitions #22

Open benhickson opened 9 months ago

maartenvandillen commented 1 week ago

chatGPT suggested these and seem to work (use at your own risk, I haven't checked if they're correct) :


declare module 'react-scale-text' {
  import * as React from 'react';

  interface ScaleTextProps {
    /** The minimum font size (in pixels) to be used when scaling down the text */
    minFontSize?: number;
    /** The maximum font size (in pixels) to be used when scaling up the text */
    maxFontSize?: number;
    /** Any additional class names to apply to the component */
    className?: string;
    /** Optional callback function that gets called when the font size changes */
    onFontSizeChange?: (fontSize: number) => void;
    /** Children components to be rendered inside the ScaleText component */
    children: React.ReactNode;
    /** If true, only the width of the text will be scaled */
    widthOnly?: boolean;
  }

  export default class ScaleText extends React.Component<ScaleTextProps> {}
}