unpack props inside component bodies

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2023-02-27 15:31:15 +01:00
parent babbaa9391
commit 65454876fb
51 changed files with 253 additions and 297 deletions
+11 -12
View File
@@ -84,7 +84,7 @@ export const DocsTable: {
createStarEntityAction(
isStarredEntity: Function,
toggleStarredEntity: Function,
): ({ entity }: DocsTableRow) => {
): (row: DocsTableRow) => {
cellStyle: {
paddingLeft: string;
};
@@ -121,9 +121,9 @@ export const EmbeddedDocsRouter: (
) => JSX.Element | null;
// @public
export const EntityListDocsGrid: ({
groups,
}: EntityListDocsGridPageProps) => JSX.Element;
export const EntityListDocsGrid: (
props: EntityListDocsGridPageProps,
) => JSX.Element;
// @public
export type EntityListDocsGridPageProps = {
@@ -147,7 +147,7 @@ export const EntityListDocsTable: {
createStarEntityAction(
isStarredEntity: Function,
toggleStarredEntity: Function,
): ({ entity }: DocsTableRow) => {
): (row: DocsTableRow) => {
cellStyle: {
paddingLeft: string;
};
@@ -315,10 +315,9 @@ export { techdocsPlugin as plugin };
export { techdocsPlugin };
// @public
export const TechDocsReaderLayout: ({
withSearch,
withHeader,
}: TechDocsReaderLayoutProps) => JSX.Element;
export const TechDocsReaderLayout: (
props: TechDocsReaderLayoutProps,
) => JSX.Element;
// @public
export type TechDocsReaderLayoutProps = {
@@ -375,9 +374,9 @@ export const TechDocsReaderPageSubheader: (props: {
}) => JSX.Element | null;
// @public
export const TechDocsReaderProvider: ({
children,
}: TechDocsReaderProviderProps) => JSX.Element;
export const TechDocsReaderProvider: (
props: TechDocsReaderProviderProps,
) => JSX.Element;
// @public
export type TechDocsReaderProviderProps = {
@@ -55,13 +55,11 @@ const allEntitiesGroup: DocsGroupConfig = {
filterPredicate: () => true,
};
const EntityListDocsGridGroup = ({
entities,
group,
}: {
const EntityListDocsGridGroup = (props: {
group: DocsGroupConfig;
entities: Entity[];
}) => {
const { entities, group } = props;
const { loading: loadingOwnership, isOwnedEntity } = useEntityOwnership();
const shownEntities = entities.filter(entity => {
@@ -103,7 +101,7 @@ const EntityListDocsGridGroup = ({
*
* @public
*/
export const EntityListDocsGrid = ({ groups }: EntityListDocsGridPageProps) => {
export const EntityListDocsGrid = (props: EntityListDocsGridPageProps) => {
const { loading, error, entities } = useEntityList();
if (error) {
@@ -143,7 +141,7 @@ export const EntityListDocsGrid = ({ groups }: EntityListDocsGridPageProps) => {
return (
<Content>
{(groups || [allEntitiesGroup]).map((group, index: number) => (
{(props.groups || [allEntitiesGroup]).map((group, index: number) => (
<EntityListDocsGridGroup
entities={entities}
group={group}
@@ -47,7 +47,8 @@ export const actionFactories = {
isStarredEntity: Function,
toggleStarredEntity: Function,
) {
return ({ entity }: DocsTableRow) => {
return (row: DocsTableRow) => {
const entity = row.entity;
const isStarred = isStarredEntity(entity);
return {
cellStyle: { paddingLeft: '1em' },
@@ -132,10 +132,8 @@ export type TechDocsReaderLayoutProps = {
* Default TechDocs reader page structure composed with a header and content
* @public
*/
export const TechDocsReaderLayout = ({
withSearch,
withHeader = true,
}: TechDocsReaderLayoutProps) => {
export const TechDocsReaderLayout = (props: TechDocsReaderLayoutProps) => {
const { withSearch, withHeader = true } = props;
return (
<Page themeId="documentation">
{withHeader && <TechDocsReaderPageHeader />}
@@ -48,9 +48,9 @@ export type TechDocsReaderProviderProps = {
*
* @public
*/
export const TechDocsReaderProvider = ({
children,
}: TechDocsReaderProviderProps) => {
export const TechDocsReaderProvider = (props: TechDocsReaderProviderProps) => {
const { children } = props;
const { '*': path = '' } = useParams();
const { entityRef } = useTechDocsReaderPage();
const { kind, namespace, name } = entityRef;