refactor(projects): reuse cardEdges for the project list
This commit is contained in:
@@ -2,10 +2,10 @@ import { useRouter } from "expo-router";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { FlatList, Pressable, StyleSheet, Text, TextInput, View } from "react-native";
|
import { FlatList, Pressable, StyleSheet, Text, TextInput, View } from "react-native";
|
||||||
import Icon from "../components/Icon";
|
import Icon from "../components/Icon";
|
||||||
import { Empty, Pill, Separator } from "../components/ui";
|
import { cardEdges, Empty, Pill, Separator } from "../components/ui";
|
||||||
import { haptic } from "../lib/haptics";
|
import { haptic } from "../lib/haptics";
|
||||||
import { activeProjects, createProject, openTaskCount } from "../lib/store";
|
import { activeProjects, createProject, openTaskCount } from "../lib/store";
|
||||||
import { C, radius, shadow, space, type } from "../lib/theme";
|
import { C, radius, space, type } from "../lib/theme";
|
||||||
import { useStore } from "../lib/useStore";
|
import { useStore } from "../lib/useStore";
|
||||||
|
|
||||||
export default function Projects() {
|
export default function Projects() {
|
||||||
@@ -42,8 +42,7 @@ export default function Projects() {
|
|||||||
<Pressable
|
<Pressable
|
||||||
style={({ pressed }) => [
|
style={({ pressed }) => [
|
||||||
s.row,
|
s.row,
|
||||||
index === 0 && s.first,
|
...cardEdges(index, projects.length),
|
||||||
index === projects.length - 1 && s.last,
|
|
||||||
pressed && { backgroundColor: C.surface2 },
|
pressed && { backgroundColor: C.surface2 },
|
||||||
]}
|
]}
|
||||||
onPress={() => router.push(`/project/${item.id}`)}
|
onPress={() => router.push(`/project/${item.id}`)}
|
||||||
@@ -92,13 +91,6 @@ const s = StyleSheet.create({
|
|||||||
gap: space.md,
|
gap: space.md,
|
||||||
paddingVertical: space.md + 2,
|
paddingVertical: space.md + 2,
|
||||||
paddingHorizontal: space.lg,
|
paddingHorizontal: space.lg,
|
||||||
backgroundColor: C.surface,
|
|
||||||
},
|
|
||||||
first: { borderTopLeftRadius: radius.lg, borderTopRightRadius: radius.lg },
|
|
||||||
last: {
|
|
||||||
borderBottomLeftRadius: radius.lg,
|
|
||||||
borderBottomRightRadius: radius.lg,
|
|
||||||
...shadow.card,
|
|
||||||
},
|
},
|
||||||
title: { ...type.row, color: C.text },
|
title: { ...type.row, color: C.text },
|
||||||
meta: { ...type.meta, color: C.muted, marginTop: 2 },
|
meta: { ...type.meta, color: C.muted, marginTop: 2 },
|
||||||
|
|||||||
Reference in New Issue
Block a user