-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8693cb4dw create status button #10
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1213.2310.20012.0 |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. daj znać po co jest jaka paczka, bo kojarzę, że coś tam było potrzebne, ale widzę teraz, że sporo tego wyszło |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react'; | ||
import { GestureResponderEvent, Pressable, StyleSheet } from 'react-native'; | ||
|
||
import { selectStatus, useTheme } from '@/hooks'; | ||
import { Status } from '@/types/status'; | ||
|
||
type Props = React.ComponentPropsWithRef<typeof Pressable> & { | ||
status: Status; | ||
onPress: (event: GestureResponderEvent) => void; | ||
}; | ||
|
||
const StatusButton = (param: Props) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
const { themedStyles } = useTheme(); | ||
const actualStatus: Status = 'Inaccessible'; //added temporarily until the selected status is supported | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nie do końca rozumiem o co tutaj chodzi osobiście |
||
const buttonStatus: Status = param.status; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nie musisz przypisywać tego do zmiennej jeśli i tak wykorzystujesz to w kodzie jeden raz |
||
|
||
return ( | ||
<Pressable | ||
style={[ | ||
styles.button, | ||
actualStatus === param.status | ||
? { backgroundColor: themedStyles.buttonActive } | ||
: { backgroundColor: themedStyles.buttonBackground }, | ||
]} | ||
> | ||
{selectStatus(buttonStatus)} | ||
</Pressable> | ||
); | ||
}; | ||
export default StatusButton; | ||
|
||
const styles = StyleSheet.create({ | ||
button: { | ||
justifyContent: 'center', | ||
width: 232, | ||
height: 44, | ||
borderRadius: 10, | ||
paddingLeft: 10, | ||
marginTop: 10, | ||
shadowColor: '#000', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. starajmy się nie używać hardcored colors tylko używajmy zmiennych z pliku There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Jak coś to wszystko jest opisane w readme |
||
shadowOffset: { width: 0, height: 10 }, | ||
shadowOpacity: 1, | ||
shadowRadius: 10, | ||
elevation: 5, | ||
// to improve the shade | ||
}, | ||
}); |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Zauważ, że powielasz jeden schemat tworzenia komponentu 5 razy. Można to rozwiązać w tym przypadku następująco: AccessibleStatusButton = () => { I to samo dla pozostałych, tylko przekażesz inny props |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import { StyleSheet, Text, View } from 'react-native'; | ||
import Svg, { Path } from 'react-native-svg'; | ||
|
||
import { useTheme } from '@/hooks'; | ||
|
||
const AccessibleStatusButton = () => { | ||
const { themedStyles } = useTheme(); | ||
return ( | ||
<View> | ||
<Svg width="24" height="24" viewBox="0 0 24 24" fill="none"> | ||
<Path | ||
fill-rule="evenodd" | ||
clip-rule="evenodd" | ||
d="M24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0C18.6274 0 24 5.37258 24 12ZM19.6005 7.20247C19.8067 7.38614 19.825 7.70219 19.6413 7.9084L10.2774 18.4218C10.2612 18.44 10.244 18.4567 10.2259 18.4719C10.2144 18.4839 10.2022 18.4954 10.1893 18.5064C9.97928 18.6856 9.66369 18.6606 9.48444 18.4506L6.75481 15.2516C6.57557 15.0415 6.60055 14.7259 6.81062 14.5467C7.02068 14.3674 7.33627 14.3924 7.51552 14.6025L9.87603 17.3689L18.8946 7.2433C19.0782 7.03709 19.3943 7.01881 19.6005 7.20247Z" | ||
fill="#37B744" | ||
/> | ||
</Svg> | ||
<Text style={{ ...styles.text, color: themedStyles.buttonText }}> | ||
Accesible | ||
</Text> | ||
</View> | ||
); | ||
}; | ||
export default AccessibleStatusButton; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. zachowuj odstępy pomiędzy takimi rzeczami jak komponent, export, style |
||
const styles = StyleSheet.create({ | ||
text: { | ||
fontSize: 12, | ||
paddingHorizontal: 30, | ||
paddingVertical: 4, | ||
position: 'absolute', | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import { StyleSheet, Text, View } from 'react-native'; | ||
import Svg, { Path } from 'react-native-svg'; | ||
|
||
import { useTheme } from '@/hooks'; | ||
|
||
const BeRightBackStatusButton = () => { | ||
const { themedStyles } = useTheme(); | ||
return ( | ||
<View> | ||
<Svg width="24" height="24" viewBox="0 0 24 24" fill="none"> | ||
<Path | ||
fill-rule="evenodd" | ||
clip-rule="evenodd" | ||
d="M12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24ZM11.5001 12.5588L11.5002 12.5686C11.4966 12.7072 11.5502 12.8465 11.6597 12.9482L16.0678 17.0428C16.2701 17.2307 16.5865 17.219 16.7744 17.0167C16.9624 16.8144 16.9507 16.498 16.7484 16.3101L12.5001 12.3639V3.5C12.5001 3.22386 12.2762 3 12.0001 3C11.7239 3 11.5001 3.22386 11.5001 3.5V12.5588Z" | ||
fill="#FED815" | ||
/> | ||
</Svg> | ||
<Text style={{ ...styles.text, color: themedStyles.buttonText }}> | ||
Be Right Back | ||
</Text> | ||
</View> | ||
); | ||
}; | ||
export default BeRightBackStatusButton; | ||
const styles = StyleSheet.create({ | ||
text: { | ||
fontSize: 12, | ||
paddingHorizontal: 30, | ||
paddingVertical: 4, | ||
position: 'absolute', | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import { StyleSheet, Text, View } from 'react-native'; | ||
import Svg, { Circle } from 'react-native-svg'; | ||
|
||
import { useTheme } from '@/hooks'; | ||
|
||
const DefaultButtonStatus = () => { | ||
const { themedStyles } = useTheme(); | ||
return ( | ||
<View> | ||
<Svg width="24" height="24" viewBox="0 0 24 24" fill="none"> | ||
<Circle cx="12" cy="12" r="12" fill="#D9D9D9" /> | ||
</Svg> | ||
<Text style={{ ...styles.text, color: themedStyles.buttonText }}> | ||
default | ||
</Text> | ||
</View> | ||
); | ||
}; | ||
export default DefaultButtonStatus; | ||
const styles = StyleSheet.create({ | ||
text: { | ||
fontSize: 12, | ||
paddingHorizontal: 30, | ||
paddingVertical: 4, | ||
position: 'absolute', | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import { StyleSheet, Text, View } from 'react-native'; | ||
import Svg, { Circle } from 'react-native-svg'; | ||
|
||
import { useTheme } from '@/hooks'; | ||
|
||
const DoNotDisturbStatusButton = () => { | ||
const { themedStyles } = useTheme(); | ||
return ( | ||
<View> | ||
<Svg width="24" height="24" viewBox="0 0 24 24" fill="none"> | ||
<Circle cx="12" cy="12" r="12" fill="#DF2B2B" /> | ||
</Svg> | ||
|
||
<Text style={{ ...styles.text, color: themedStyles.buttonText }}> | ||
Do not Disturb | ||
</Text> | ||
</View> | ||
); | ||
}; | ||
export default DoNotDisturbStatusButton; | ||
const styles = StyleSheet.create({ | ||
text: { | ||
fontSize: 12, | ||
paddingHorizontal: 30, | ||
paddingVertical: 4, | ||
position: 'absolute', | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react'; | ||
import { StyleSheet, Text, View } from 'react-native'; | ||
import Svg, { Path } from 'react-native-svg'; | ||
|
||
import { useTheme } from '@/hooks'; | ||
|
||
const InaccessibleStatusButton = () => { | ||
const { themedStyles } = useTheme(); | ||
return ( | ||
<View> | ||
<Svg width="24" height="24" viewBox="0 0 24 24" fill="#000"> | ||
<Path | ||
fill-rule="evenodd" | ||
clip-rule="evenodd" | ||
d="M24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0C18.6274 0 24 5.37258 24 12ZM5.64645 5.64645C5.84171 5.45118 6.15829 5.45118 6.35355 5.64645L12 11.2929L17.6464 5.64646C17.8417 5.4512 18.1583 5.4512 18.3535 5.64646C18.5488 5.84172 18.5488 6.1583 18.3535 6.35357L12.7071 12L18.3535 17.6464C18.5488 17.8417 18.5488 18.1583 18.3535 18.3535C18.1583 18.5488 17.8417 18.5488 17.6464 18.3535L12 12.7071L6.35355 18.3536C6.15829 18.5488 5.84171 18.5488 5.64645 18.3536C5.45118 18.1583 5.45118 17.8417 5.64645 17.6464L11.2929 12L5.64645 6.35355C5.45118 6.15829 5.45118 5.84171 5.64645 5.64645Z" | ||
fill="#D9D9D9" | ||
/> | ||
</Svg> | ||
|
||
<Text style={{ ...styles.text, color: themedStyles.buttonText }}> | ||
Inaccessible | ||
</Text> | ||
</View> | ||
); | ||
}; | ||
export default InaccessibleStatusButton; | ||
const styles = StyleSheet.create({ | ||
text: { | ||
fontSize: 12, | ||
paddingHorizontal: 30, | ||
paddingVertical: 4, | ||
position: 'absolute', | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { default as PrimaryButton } from './PrimaryButton'; | ||
export { default as StatusButton } from './StatusButton'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export { default as PrimaryButton } from './PrimaryButton'; | ||
export { default as SwitchTheme } from './SwitchTheme'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './useStatus'; | ||
export * from './useTheme'; |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to niestety nie jest ani trochę hook, wrzuć to do komponentu |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
|
||
import AccessibleStatusButton from '@/components/Button/StatusButton/AccessibleStatusButton'; | ||
import BeRightBackStatusButton from '@/components/Button/StatusButton/BeRightBackStatusButton'; | ||
import DefaultButtonStatus from '@/components/Button/StatusButton/DefaultButtonStatus'; | ||
import DoNotDisturbStatusButton from '@/components/Button/StatusButton/DoNotDisturbStatusButton'; | ||
import InaccessibleStatusButton from '@/components/Button/StatusButton/InaccessibleStatusButton'; | ||
import { Status } from '@/types/status'; | ||
|
||
export const selectStatus = (property: Status) => { | ||
switch (property) { | ||
case 'Inaccessible': | ||
return <InaccessibleStatusButton />; | ||
case 'Accessible': | ||
return <AccessibleStatusButton />; | ||
case 'DoNotDisturb': | ||
return <DoNotDisturbStatusButton />; | ||
case 'BeRightBack': | ||
return <BeRightBackStatusButton />; | ||
default: | ||
return <DefaultButtonStatus />; | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const STATUSES = [ | ||
'Inaccessible', | ||
'Accessible', | ||
'DoNotDisturb', | ||
'BeRightBack', | ||
]; | ||
export type Status = (typeof STATUSES)[number]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,14 @@ export const globalStyles = StyleSheet.create({ | |
|
||
export const darkColors = { | ||
primary: 'blue', | ||
buttonBackground: 'blue', | ||
buttonText: 'white', | ||
buttonActive: '#E4E4E4', | ||
Comment on lines
+19
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nie używajmy kolorów typu blue, white, zamiast tego używajmy hexa zgodnie z figmą |
||
}; | ||
|
||
export const lightColors = { | ||
primary: 'green', | ||
buttonBackground: 'white', | ||
buttonText: 'black', | ||
buttonActive: '#E4E4E4', | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
co to za plik