Skip to content

Commit

Permalink
Rename component Table to settings-list
Browse files Browse the repository at this point in the history
  • Loading branch information
lourou committed Jan 16, 2025
1 parent 708b676 commit f9bdac9
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 45 deletions.
34 changes: 0 additions & 34 deletions design-system/Table/Table.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import { useAppTheme, ThemedStyle } from "@/theme/useAppTheme";
import { HStack } from "@/design-system/HStack";
import { VStack } from "@/design-system/VStack";
import { Icon } from "@/design-system/Icon/Icon";
import { ITableRow } from "./Table.types";
import { ISettingsListRow } from "./settings-list.types";

type ITableRowProps = {
row: ITableRow;
type ISettingsListRowProps = {
row: ISettingsListRow;
editMode?: boolean;
};

export const TableRow = memo(function TableRow({
export const SettingsListRow = memo(function SettingsListRow({
row,
editMode,
}: ITableRowProps) {
}: ISettingsListRowProps) {
const { theme, themed } = useAppTheme();

const content = (
Expand Down
33 changes: 33 additions & 0 deletions design-system/settings-list/settings-list.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React, { memo } from "react";
import { View, ViewStyle } from "react-native";
import { useAppTheme, ThemedStyle } from "@/theme/useAppTheme";
import { SettingsListRow } from "./settings-list-row";
import { ISettingsListRow } from "./settings-list.types";

type ISettingsListProps = {
rows: ISettingsListRow[];
editMode?: boolean;
};

export const SettingsList = memo(function SettingsList({
rows,
editMode,
}: ISettingsListProps) {
const { themed } = useAppTheme();

return (
<View style={themed($container)}>
{rows.map((row, index) => (
<SettingsListRow
key={row.label + index}
row={row}
editMode={editMode}
/>
))}
</View>
);
});

const $container: ThemedStyle<ViewStyle> = () => ({
width: "100%",
});
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export type ITableRow = {
export type ISettingsListRow = {
label: string;
value?: string | number;
value?: string | boolean;
onPress?: () => void;
onValueChange?: (value: boolean) => void;
isSwitch?: boolean;
isWarning?: boolean;
isSwitch?: boolean;
disabled?: boolean;
onPress?: () => void;
};
4 changes: 2 additions & 2 deletions screens/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from "react-native";
import { Screen } from "@/components/Screen/ScreenComp/Screen";
import { ContactCard } from "@/features/profiles/components/contact-card";
import { Table } from "@/design-system/Table/Table";
import { SettingsList } from "@/design-system/settings-list/settings-list";
import { VStack } from "@/design-system/VStack";
import { Text } from "@/design-system/Text";
import { useRoute, useRouter } from "@navigation/useNavigation";
Expand Down Expand Up @@ -274,7 +274,7 @@ export default function ProfileScreen() {
<VStack
style={[themed($section), { paddingVertical: theme.spacing.lg }]}
>
<Table
<SettingsList
editMode={editMode}
rows={[
...(notificationsPermissionStatus !== "granted"
Expand Down

0 comments on commit f9bdac9

Please sign in to comment.