Refactor styles in instruction or object selector

This commit is contained in:
AlexandreSi
2023-10-03 09:49:13 +02:00
parent 3f31174975
commit c7d98eaa92
2 changed files with 10 additions and 5 deletions

View File

@@ -62,6 +62,10 @@ import Text from '../../UI/Text';
const gd: libGDevelop = global.gd;
const DISPLAYED_INSTRUCTIONS_MAX_LENGTH = 20;
export const styles = {
noObjectsText: { opacity: 0.7 },
indentedListItem: { paddingLeft: 45 },
};
export type TabName = 'objects' | 'free-instructions';
@@ -489,11 +493,11 @@ export default class InstructionOrObjectSelector extends React.PureComponent<
<ListItem
key={`${group.getName()}-empty`}
primaryText={
<Text style={{ opacity: 0.6 }} noMargin>
<Text style={styles.noObjectsText} noMargin>
<Trans>No objects in the group</Trans>
</Text>
}
style={{ paddingLeft: 45 }}
style={styles.indentedListItem}
/>
);
} else {
@@ -529,11 +533,11 @@ export default class InstructionOrObjectSelector extends React.PureComponent<
<ListItem
key={`${folderWithPath.path}-empty`}
primaryText={
<Text style={{ opacity: 0.6 }} noMargin>
<Text style={styles.noObjectsText} noMargin>
<Trans>No objects in the folder</Trans>
</Text>
}
style={{ paddingLeft: 45 }}
style={styles.indentedListItem}
/>
);
} else {

View File

@@ -9,6 +9,7 @@ import {
getObjectListItemKey,
} from './Keys';
import HighlightedText from '../../../UI/Search/HighlightedText';
import { styles } from '../InstructionOrObjectSelector';
import { type HTMLDataset } from '../../../Utils/HTMLDataset';
type Props = {|
@@ -45,7 +46,7 @@ export const renderObjectListItem = ({
selected={
selectedValue === getObjectOrObjectGroupListItemValue(objectName)
}
style={withIndent ? { paddingLeft: 45 } : undefined}
style={withIndent ? styles.indentedListItem : undefined}
primaryText={
<HighlightedText
text={objectName}