Skip to content

Commit

Permalink
feat: use Renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
SophieManley03 committed Jun 13, 2022
1 parent cf0254c commit 7022f3c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
3 changes: 0 additions & 3 deletions packages/recommend-vdom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
"build": "yarn build:clean && yarn build:esm && yarn build:umd && yarn build:types",
"prepare": "yarn build:esm && yarn build:types"
},
"dependencies": {
"preact": "^10.0.0"
},
"devDependencies": {
"@algolia/recommend-core": "1.3.1"
}
Expand Down
16 changes: 5 additions & 11 deletions packages/recommend-vdom/src/types/RecommendComponentProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,14 @@ import { FacetsViewProps } from './FacetsViewProps';
import { RecommendClassNames } from './RecommendClassNames';
import { RecommendStatus } from './RecommendStatus';
import { RecommendTranslations } from './RecommendTranslations';
import { Pragma, PragmaFrag } from './Renderer';
import { Renderer } from './Renderer';
import { ViewProps } from './ViewProps';

export type ItemComponentProps<TObject> = {
item: TObject;
} & RenderProps;
} & Renderer;

export type RenderProps = {
createElement: Pragma;
Fragment: PragmaFrag;
};

export type HeaderComponentProps<TObject> = RenderProps &
ComponentProps<TObject>;
export type HeaderComponentProps<TObject> = Renderer & ComponentProps<TObject>;

export type ComponentProps<TObject> = {
classNames: RecommendClassNames;
Expand All @@ -37,7 +31,7 @@ export type RecommendComponentProps<TObject> = {
items: Array<RecordWithObjectID<TObject>>;
classNames?: RecommendClassNames;
children?(props: ChildrenProps<TObject>): JSX.Element;
fallbackComponent?(props: RenderProps): JSX.Element;
fallbackComponent?(props: Renderer): JSX.Element;
headerComponent?(props: HeaderComponentProps<TObject>): JSX.Element;
status: RecommendStatus;
translations?: RecommendTranslations;
Expand All @@ -55,7 +49,7 @@ export type TrendingComponentProps<TObject> = {
items: Array<FacetEntry<TObject>>;
classNames?: RecommendClassNames;
children?(props: ChildrenProps<TObject>): JSX.Element;
fallbackComponent?(props: RenderProps): JSX.Element;
fallbackComponent?(props: Renderer): JSX.Element;
headerComponent?(props: HeaderComponentProps<TObject>): JSX.Element;
status: RecommendStatus;
translations?: RecommendTranslations;
Expand Down
4 changes: 2 additions & 2 deletions packages/recommend-vdom/src/types/ViewProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export type ViewProps<
classNames: TClassNames;
itemComponent({
item: TItem,
createElement: Pragma,
Fragment: PragmaFrag,
createElement: TPragma,
Fragment: TPragmaFrag,
}): JSX.Element;
items: TItem[];
translations: TTranslations;
Expand Down

0 comments on commit 7022f3c

Please sign in to comment.