Skip to content

Commit

Permalink
chore(repeater-native): rename to empty placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
Andries-Smit committed Mar 28, 2023
1 parent 20a1ab2 commit 6caf5b0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export function getPreview(values: RepeaterPreviewProps, isDarkMode: boolean): S
children: [
{
type: "DropZone",
placeholder: "Content when Empty",
property: values.contentEmpty
placeholder: "No items placeholder: Place widgets here",
property: values.emptyPlaceholder
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions packages/pluggableWidgets/repeater-native/src/Repeater.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ export function Repeater(props: RepeaterProps<RepeaterStyle>): ReactElement {
if (props.datasource.status === ValueStatus.Loading || !props.datasource.items) {
return <View />;
}
const contentEmpty = props.datasource.items.length === 0 ? props.contentEmpty : null;
const emptyPlaceholder = props.datasource.items.length === 0 ? props.emptyPlaceholder : null;
return (
<View style={styles.container}>
{props.datasource.items.map((item, index) => (
<Fragment key={`item_${index}`}>{props.content.get(item)}</Fragment>
))}
{contentEmpty}
{emptyPlaceholder}
</View>
);
}
4 changes: 2 additions & 2 deletions packages/pluggableWidgets/repeater-native/src/Repeater.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<caption>Content</caption>
<description/>
</property>
<property key="contentEmpty" type="widgets" required="false">
<caption>Content empty</caption>
<property key="emptyPlaceholder" type="widgets" required="false">
<caption>Empty placeholder</caption>
<description/>
</property>
</propertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface RepeaterProps<Style> {
style: Style[];
datasource: ListValue;
content: ListWidgetValue;
contentEmpty?: ReactNode;
emptyPlaceholder?: ReactNode;
}

export interface RepeaterPreviewProps {
Expand All @@ -25,5 +25,5 @@ export interface RepeaterPreviewProps {
readOnly: boolean;
datasource: {} | { type: string } | null;
content: { widgetCount: number; renderer: ComponentType<{ caption?: string }> };
contentEmpty: { widgetCount: number; renderer: ComponentType<{ caption?: string }> };
emptyPlaceholder: { widgetCount: number; renderer: ComponentType<{ caption?: string }> };
}

0 comments on commit 6caf5b0

Please sign in to comment.