mirror of
				https://gitlab.com/ceda_ei/sonzai.git
				synced 2025-11-04 09:00:05 +01:00 
			
		
		
		
	Use IconButton instead of Button for Remove. Align to right.
This commit is contained in:
		@@ -1,11 +1,12 @@
 | 
				
			|||||||
import React, { useState } from "react";
 | 
					import React, { useState } from "react";
 | 
				
			||||||
import PropTypes from "prop-types";
 | 
					import PropTypes from "prop-types";
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
	Button,
 | 
						IconButton,
 | 
				
			||||||
	Card,
 | 
						Card,
 | 
				
			||||||
	FAB,
 | 
						FAB,
 | 
				
			||||||
	Portal,
 | 
						Portal,
 | 
				
			||||||
	Text
 | 
						Text,
 | 
				
			||||||
 | 
						withTheme
 | 
				
			||||||
} from "react-native-paper";
 | 
					} from "react-native-paper";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
@@ -15,7 +16,7 @@ import {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import InputDialog from "./InputDialog";
 | 
					import InputDialog from "./InputDialog";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default function Subjects({ subjects, addSubject, removeSubject }) {
 | 
					function Subjects({ theme, subjects, addSubject, removeSubject }) {
 | 
				
			||||||
	const [ showDialog, setShowDialog ] = useState(false);
 | 
						const [ showDialog, setShowDialog ] = useState(false);
 | 
				
			||||||
	function onInput(text) {
 | 
						function onInput(text) {
 | 
				
			||||||
		addSubject(text);
 | 
							addSubject(text);
 | 
				
			||||||
@@ -40,10 +41,12 @@ export default function Subjects({ subjects, addSubject, removeSubject }) {
 | 
				
			|||||||
					}
 | 
										}
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
					<Card.Title title={subject.name} />
 | 
										<Card.Title title={subject.name} />
 | 
				
			||||||
					<Card.Actions>
 | 
										<Card.Actions style={{justifyContent: "flex-end"}}>
 | 
				
			||||||
						<Button onPress={() => removeSubject(subject.id)}>
 | 
											<IconButton
 | 
				
			||||||
							Remove
 | 
												onPress={() => removeSubject(subject.id)}
 | 
				
			||||||
						</Button>
 | 
												icon="delete"
 | 
				
			||||||
 | 
												color={theme.colors.primary}
 | 
				
			||||||
 | 
											/>
 | 
				
			||||||
					</Card.Actions>
 | 
										</Card.Actions>
 | 
				
			||||||
				</Card>
 | 
									</Card>
 | 
				
			||||||
			))}
 | 
								))}
 | 
				
			||||||
@@ -76,6 +79,7 @@ Subjects.propTypes = {
 | 
				
			|||||||
	subjects: PropTypes.array,
 | 
						subjects: PropTypes.array,
 | 
				
			||||||
	addSubject: PropTypes.func,
 | 
						addSubject: PropTypes.func,
 | 
				
			||||||
	removeSubject: PropTypes.func,
 | 
						removeSubject: PropTypes.func,
 | 
				
			||||||
 | 
						theme: PropTypes.object,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const style = StyleSheet.create({
 | 
					const style = StyleSheet.create({
 | 
				
			||||||
@@ -89,3 +93,5 @@ const style = StyleSheet.create({
 | 
				
			|||||||
		textAlign: "center",
 | 
							textAlign: "center",
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default withTheme(Subjects);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user