Skip to content

Commit

Permalink
feat(types): Bundle definition types file (#7)
Browse files Browse the repository at this point in the history
* feat(types): Export type for Text

* fix(ci/cd): Bundle definition types files
  • Loading branch information
annelhote authored Jul 16, 2024
1 parent abdad2b commit 1c7c0e5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"type": "module",
"main": "./dist/dsfr-plus.es.js",
"module": "./dist/dsfr-plus.es.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
Expand Down
6 changes: 4 additions & 2 deletions src/components/Typography/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import { OnlyAs, PolymorphicComponent } from 'react-polymorphed';
type TextTags = 'p' | 'span';
type TextSizes = 'xs' | 'sm' | 'md' | 'lg' | 'lead';

type TextProps = React.PropsWithChildren<{
type TextPropsPartial = React.PropsWithChildren<{
alt?: boolean;
bold?: boolean;
className?: Argument;
size?: TextSizes;
}>

export const Text: PolymorphicComponent<"p", TextProps, OnlyAs<TextTags>> = ({
export type TextProps = PolymorphicComponent<"p", TextPropsPartial, OnlyAs<TextTags>>;

export const Text: TextProps = ({
alt,
as: As = 'p',
bold,
Expand Down
2 changes: 2 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export * from './colors';
export * from './headings';
export * from './polymophic';

0 comments on commit 1c7c0e5

Please sign in to comment.