-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show status-box for 'you' and 'vacationing' in MentorCards
- Loading branch information
1 parent
4585882
commit 65ffcc0
Showing
6 changed files
with
104 additions
and
40 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
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,52 @@ | ||
import React from 'react'; | ||
import RN from 'react-native'; | ||
import { useSelector } from 'react-redux'; | ||
|
||
import * as api from '../../api/mentors'; | ||
import * as tokenState from '../../state/reducers/accessToken'; | ||
|
||
import colors from './colors'; | ||
import fonts from './fonts'; | ||
import Message from './Message'; | ||
|
||
type Props = { | ||
mentor: api.Mentor; | ||
}; | ||
|
||
export const MentorTitleSpecial: React.FC<Props> = ({ | ||
mentor: { buddyId, is_vacationing }, | ||
}) => { | ||
const isMe = useSelector(tokenState.isMe(buddyId)); | ||
|
||
const message = isMe | ||
? 'main.mentor.special.you' | ||
: 'main.mentor.special.notAvailable'; | ||
|
||
const shouldShow = isMe || is_vacationing; | ||
|
||
return shouldShow ? ( | ||
<RN.View | ||
style={[ | ||
styles.special, | ||
{ backgroundColor: isMe ? colors.lightBlue : colors.whiteBlue }, | ||
]} | ||
> | ||
<Message id={message} style={styles.text} /> | ||
</RN.View> | ||
) : null; | ||
}; | ||
|
||
const styles = RN.StyleSheet.create({ | ||
special: { | ||
position: 'absolute', | ||
right: 40, | ||
top: 0, | ||
borderRadius: 4, | ||
padding: 8, | ||
zIndex: 10, | ||
}, | ||
text: { | ||
...fonts.smallBold, | ||
color: colors.darkestBlue, | ||
}, | ||
}); |
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