-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/re 2492 profil communication (#871)
- Loading branch information
Showing
26 changed files
with
497 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react' | ||
import BoundarySuspenseWrapper from '@/components/BoundarySuspenseWrapper' | ||
import ProfilLayout from '@/components/layouts/ProfilLayout' | ||
import * as metatags from '@/config/metatags' | ||
import ComScreen from '@/screens/profil/communications/page' | ||
import Head from 'expo-router/head' | ||
|
||
function CommunicationScreen() { | ||
return ( | ||
<> | ||
<Head> | ||
<title>{metatags.createTitle('Cotisation et dons')}</title> | ||
</Head> | ||
|
||
<ProfilLayout> | ||
<BoundarySuspenseWrapper> | ||
<ComScreen /> | ||
</BoundarySuspenseWrapper> | ||
</ProfilLayout> | ||
</> | ||
) | ||
} | ||
|
||
export default CommunicationScreen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Fragment } from 'react' | ||
import { Calendar } from '@tamagui/lucide-icons' | ||
import { ScrollView, Stack, Text, XStack, YStack } from 'tamagui' | ||
import { MessageCard } from './MessageCard' | ||
|
||
export default { | ||
title: 'MessageCard', | ||
component: MessageCard, | ||
} | ||
|
||
export function Default() { | ||
const colors = ['gray', 'purple', 'orange', 'blue', 'green', 'yellow'] as const | ||
|
||
return ( | ||
<ScrollView flex={1} alignContent="center" justifyContent="center"> | ||
<Stack gap="$4"> | ||
<YStack gap="$2"> | ||
{colors.map((c) => ( | ||
<MessageCard key={c} theme={c} iconLeft={Calendar}> | ||
Label | ||
</MessageCard> | ||
))} | ||
</YStack> | ||
</Stack> | ||
</ScrollView> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, { ComponentProps, NamedExoticComponent } from 'react' | ||
import Text from '@/components/base/Text' | ||
import type { IconProps } from '@tamagui/helpers-icon' | ||
import { View, XStack } from 'tamagui' | ||
import VoxCard from '../VoxCard/VoxCard' | ||
|
||
type Props = { | ||
children: string | string[] | ||
iconLeft: NamedExoticComponent<IconProps> | ||
rightComponent?: React.ReactNode | ||
} & ComponentProps<typeof VoxCard> | ||
|
||
export const MessageCard = ({ children, iconLeft: IconLeft, rightComponent, ...props }: Props) => ( | ||
<VoxCard inside bg="$color1" {...props}> | ||
<VoxCard.Content> | ||
<XStack gap={16} alignItems="center"> | ||
<View width={24} height={24}> | ||
<IconLeft size={24} color="$color7" /> | ||
</View> | ||
<Text.MD multiline color="$color7" semibold> | ||
{children} | ||
</Text.MD> | ||
{rightComponent ?? null} | ||
</XStack> | ||
</VoxCard.Content> | ||
</VoxCard> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react' | ||
import SwitchGroup from './SwitchGroup' | ||
|
||
export default { | ||
title: 'SwitchGroup', | ||
component: SwitchGroup, | ||
} | ||
|
||
const list = [ | ||
{ label: 'Option 1', value: 'option1' }, | ||
{ label: 'Option 2', value: 'option2' }, | ||
{ label: 'Option 3', value: 'option3' }, | ||
] | ||
|
||
export const Default = () => { | ||
const [value, setValue] = React.useState(['option1']) | ||
return <SwitchGroup options={list} value={value} onChange={setValue} /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { useState } from 'react' | ||
import Switch from '@/components/base/SwitchV2/SwitchV2' | ||
import Text from '@/components/base/Text' | ||
import { styled } from '@tamagui/core' | ||
import { ThemeableStack, XStack } from 'tamagui' | ||
|
||
type SwitchGroupProps = { | ||
options: { | ||
label: string | ||
value: string | ||
}[] | ||
value: string[] | ||
onChange: (value: string[]) => void | ||
} | ||
|
||
const SwitchGroupFrame = styled(ThemeableStack, { | ||
gap: '$3', | ||
flexDirection: 'column', | ||
}) | ||
|
||
export default function SwitchGroup({ options, value, onChange }: SwitchGroupProps) { | ||
const handlePress = (item: string) => () => { | ||
if (value.includes(item)) { | ||
onChange(value.filter((v) => v !== item)) | ||
return | ||
} | ||
onChange([...value, item]) | ||
} | ||
|
||
const isChecked = (item: string) => value.includes(item) | ||
return ( | ||
<SwitchGroupFrame> | ||
{options.map((option) => ( | ||
<XStack key={option.value} gap="$2" group onPress={handlePress(option.value)} alignItems="center" cursor="pointer" justifyContent="space-between"> | ||
<Text.MD multiline flexShrink={1}> | ||
{option.label} | ||
</Text.MD> | ||
<Switch checked={isChecked(option.value)} onPress={handlePress(option.value)} /> | ||
</XStack> | ||
))} | ||
</SwitchGroupFrame> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { YStack } from 'tamagui' | ||
import Switch from './SwitchV2' | ||
|
||
export default { | ||
title: 'SwitchV2', | ||
component: Switch, | ||
} | ||
|
||
export const Default = () => ( | ||
<YStack> | ||
<Switch /> | ||
<Switch checked /> | ||
<Switch disabled /> | ||
<Switch checked disabled /> | ||
</YStack> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from 'react' | ||
import { createStyledContext, GetThemeValueForKey, getVariableValue, styled } from '@tamagui/core' | ||
import { Check } from '@tamagui/lucide-icons' | ||
import { ThemeableStack } from '@tamagui/stacks' | ||
|
||
export const SwitchContext = createStyledContext({ | ||
checked: false, | ||
disabled: false, | ||
}) | ||
|
||
export const SwitchGroupZone = styled(ThemeableStack, { | ||
tag: 'button', | ||
context: SwitchContext, | ||
focusable: true, | ||
height: 24 + 16, | ||
width: 40 + 16, | ||
borderRadius: 1000, | ||
group: true, | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
cursor: 'pointer', | ||
animation: 'bouncy', | ||
'$group-hover': { backgroundColor: '$blue2' }, | ||
focusStyle: { | ||
backgroundColor: '$blue2', | ||
}, | ||
hoverStyle: { | ||
backgroundColor: '$blue2', | ||
}, | ||
disabledStyle: { | ||
cursor: 'not-allowed', | ||
opacity: 0.4, | ||
backgroundColor: 'transparent', | ||
}, | ||
variants: { | ||
checked: { | ||
true: {}, | ||
}, | ||
} as const, | ||
}) | ||
|
||
export const SwitchGroupItemFrame = styled(ThemeableStack, { | ||
context: SwitchContext, | ||
animation: 'bouncy', | ||
borderRadius: 999, | ||
height: 24, | ||
width: 40, | ||
padding: 2, | ||
backgroundColor: '$gray3', | ||
justifyContent: 'center', | ||
|
||
variants: { | ||
checked: { | ||
true: { | ||
backgroundColor: '$blue9', | ||
}, | ||
}, | ||
} as const, | ||
}) | ||
|
||
export const SwitchGroupIndicatorFrame = styled(ThemeableStack, { | ||
context: SwitchContext, | ||
width: 20, | ||
height: 20, | ||
animation: 'bouncy', | ||
transform: [{ translateX: 0 }], | ||
borderRadius: 999, | ||
backgroundColor: '$white1', | ||
variants: { | ||
checked: { | ||
true: { | ||
transform: [{ translateX: 16 }], | ||
}, | ||
}, | ||
} as const, | ||
}) | ||
|
||
export default forwardRef<ComponentRef<typeof SwitchGroupZone>, ComponentPropsWithoutRef<typeof SwitchGroupZone> & { color?: 'blue' | 'gray' }>(function ( | ||
{ color = 'blue', ...props }, | ||
ref, | ||
) { | ||
const hintColor = color === 'gray' ? '$gray7' : '$blue9' | ||
return ( | ||
<SwitchGroupZone {...props} ref={ref}> | ||
<SwitchGroupItemFrame borderColor={props.checked ? hintColor : '$gray3'}> | ||
<SwitchGroupIndicatorFrame /> | ||
</SwitchGroupItemFrame> | ||
</SwitchGroupZone> | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.