Skip to content

Commit

Permalink
feat: add typings for <Button> (#3080)
Browse files Browse the repository at this point in the history
* feat: add typings for <Button>

* chore: bump @types/react and @types/react-dom

* feat: re-export bootstrap helpers as ComponentWithAsProp, BsPropsWithAs
  • Loading branch information
bradenmacdonald authored and PKulkoRaccoonGang committed Aug 5, 2024
1 parent 14c3b79 commit 3f69e2e
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 95 deletions.
13 changes: 8 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 0 additions & 26 deletions src/Button/ButtonGroup.test.jsx

This file was deleted.

15 changes: 0 additions & 15 deletions src/Button/ButtonToolbar.test.jsx

This file was deleted.

4 changes: 2 additions & 2 deletions src/Button/__snapshots__/Button.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ exports[`<Button /> correct rendering renders with props iconAfter and size 1`]

exports[`<Button /> correct rendering renders with props iconAfter and size 1`] = `
<button
className="btn btn-primary btn-md"
className="btn btn-primary btn-sm"
disabled={false}
type="button"
>
Button
<span
className="pgn__icon pgn__icon__md btn-icon-after"
className="pgn__icon pgn__icon__sm btn-icon-after"
>
<svg
aria-hidden={true}
Expand Down
37 changes: 0 additions & 37 deletions src/Button/__snapshots__/ButtonGroup.test.jsx.snap

This file was deleted.

8 changes: 0 additions & 8 deletions src/Button/__snapshots__/ButtonToolbar.test.jsx.snap

This file was deleted.

6 changes: 4 additions & 2 deletions src/Icon/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React from 'react';

export interface IconProps extends React.ComponentPropsWithoutRef<'span'> {
src?: React.ReactElement | Function;
// Note: React.ComponentType is what we want here. React.ElementType would allow some element type strings like "div",
// but we only want to allow components like 'Add' (a specific icon component function/class)
src?: React.ComponentType;
svgAttrs?: {
'aria-label'?: string;
'aria-labelledby'?: string;
};
id?: string | null;
size?: 'xs' | 'sm' | 'md' | 'lg';
size?: 'xs' | 'sm' | 'md' | 'lg' | 'inline';
className?: string | string[];
hidden?: boolean;
screenReaderText?: React.ReactNode;
Expand Down

0 comments on commit 3f69e2e

Please sign in to comment.