Update files
This commit is contained in:
@@ -792,20 +792,19 @@ const todoListCardStylesheet = StyleSheet.create((theme) => ({
|
|||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
gap: theme.spacing[2],
|
gap: theme.spacing[2],
|
||||||
},
|
},
|
||||||
radioOuter: {
|
radioBadge: {
|
||||||
width: 16,
|
width: 16,
|
||||||
height: 16,
|
height: 16,
|
||||||
borderRadius: 8,
|
borderRadius: 8,
|
||||||
borderWidth: theme.borderWidth[1],
|
backgroundColor: theme.colors.foregroundMuted,
|
||||||
borderColor: theme.colors.foregroundMuted,
|
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
},
|
},
|
||||||
radioInner: {
|
radioBadgeIncomplete: {
|
||||||
width: 8,
|
opacity: 0.55,
|
||||||
height: 8,
|
},
|
||||||
borderRadius: 4,
|
radioBadgeComplete: {
|
||||||
backgroundColor: theme.colors.foregroundMuted,
|
opacity: 0.95,
|
||||||
},
|
},
|
||||||
itemText: {
|
itemText: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
@@ -827,7 +826,9 @@ export const TodoListCard = memo(function TodoListCard({
|
|||||||
disableOuterSpacing,
|
disableOuterSpacing,
|
||||||
}: TodoListCardProps) {
|
}: TodoListCardProps) {
|
||||||
const { theme: unistylesTheme } = useUnistyles();
|
const { theme: unistylesTheme } = useUnistyles();
|
||||||
const [isExpanded, setIsExpanded] = useState(true);
|
const [isExpanded, setIsExpanded] = useState(false);
|
||||||
|
|
||||||
|
const nextTask = useMemo(() => items.find((item) => !item.completed)?.text, [items]);
|
||||||
|
|
||||||
const handleToggle = useCallback(() => {
|
const handleToggle = useCallback(() => {
|
||||||
setIsExpanded((prev) => !prev);
|
setIsExpanded((prev) => !prev);
|
||||||
@@ -842,8 +843,17 @@ export const TodoListCard = memo(function TodoListCard({
|
|||||||
) : (
|
) : (
|
||||||
items.map((item, idx) => (
|
items.map((item, idx) => (
|
||||||
<View key={`${item.text}-${idx}`} style={todoListCardStylesheet.itemRow}>
|
<View key={`${item.text}-${idx}`} style={todoListCardStylesheet.itemRow}>
|
||||||
<View style={todoListCardStylesheet.radioOuter}>
|
<View
|
||||||
{item.completed ? <View style={todoListCardStylesheet.radioInner} /> : null}
|
style={[
|
||||||
|
todoListCardStylesheet.radioBadge,
|
||||||
|
item.completed
|
||||||
|
? todoListCardStylesheet.radioBadgeComplete
|
||||||
|
: todoListCardStylesheet.radioBadgeIncomplete,
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{item.completed ? (
|
||||||
|
<Check size={12} color={unistylesTheme.colors.primaryForeground} />
|
||||||
|
) : null}
|
||||||
</View>
|
</View>
|
||||||
<Text
|
<Text
|
||||||
style={[
|
style={[
|
||||||
@@ -864,6 +874,7 @@ export const TodoListCard = memo(function TodoListCard({
|
|||||||
return (
|
return (
|
||||||
<ExpandableBadge
|
<ExpandableBadge
|
||||||
label="Tasks"
|
label="Tasks"
|
||||||
|
secondaryLabel={nextTask}
|
||||||
icon={CheckSquare}
|
icon={CheckSquare}
|
||||||
isExpanded={isExpanded}
|
isExpanded={isExpanded}
|
||||||
onToggle={handleToggle}
|
onToggle={handleToggle}
|
||||||
|
|||||||
Reference in New Issue
Block a user