-
-
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.
Merge pull request #3631 from TrainLCD/feature/izuhakone-number
伊豆箱根線ナンバリング対応
- Loading branch information
Showing
3 changed files
with
141 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
import React from 'react' | ||
import { StyleSheet, View } from 'react-native' | ||
import { FONTS, NUMBERING_ICON_SIZE, NumberingIconSize } from '../constants' | ||
import isTablet from '../utils/isTablet' | ||
import Typography from './Typography' | ||
|
||
type Props = { | ||
lineColor: string | ||
stationNumber: string | ||
size?: NumberingIconSize | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
root: { | ||
borderWidth: isTablet ? 3 : 2, | ||
width: isTablet ? 72 * 1.5 : 72, | ||
height: isTablet ? 72 * 1.5 : 72, | ||
borderRadius: isTablet ? 72 * 1.5 : 72, | ||
overflow: 'hidden', | ||
backgroundColor: 'white', | ||
}, | ||
rootTiny: { | ||
width: 20, | ||
height: 20, | ||
borderRadius: 16.8, | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
rootTinySymbol: { | ||
color: 'white', | ||
fontSize: isTablet ? 8 * 1.5 : 8, | ||
fontFamily: FONTS.RobotoBold, | ||
}, | ||
rootMedium: { | ||
width: isTablet ? 35 * 1.5 : 35, | ||
height: isTablet ? 35 * 1.5 : 35, | ||
borderRadius: isTablet ? 35 * 1.5 : 35, | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
mediumLineSymbol: { | ||
fontSize: isTablet ? 16 * 1.5 : 16, | ||
fontFamily: FONTS.RobotoBold, | ||
color: 'white', | ||
}, | ||
stationNumberBg: { | ||
position: 'absolute', | ||
width: '100%', | ||
height: isTablet ? 36 * 1.5 : 36, | ||
bottom: 0, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}, | ||
stationNumber: { | ||
fontSize: isTablet ? 30 * 1.5 : 30, | ||
fontFamily: FONTS.RobotoBold, | ||
textAlign: 'center', | ||
color: 'white', | ||
}, | ||
lineSymbolContainer: { | ||
width: '100%', | ||
height: isTablet ? 36 * 1.5 : 36, | ||
top: 0, | ||
position: 'absolute', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}, | ||
lineSymbol: { | ||
fontSize: isTablet ? 30 * 1.5 : 30, | ||
textAlign: 'center', | ||
fontFamily: FONTS.RobotoBold, | ||
}, | ||
divider: { | ||
top: isTablet ? (72 * 1.5) / 2 - 6 : 72 / 2 - 2, | ||
position: 'absolute', | ||
height: isTablet ? 2 : 1, | ||
left: isTablet ? -2 : -1, | ||
width: isTablet ? 72 * 1.5 : 72, | ||
backgroundColor: 'black', | ||
}, | ||
}) | ||
|
||
const NumberingIconIzuhakone: React.FC<Props> = ({ | ||
stationNumber: stationNumberRaw, | ||
size, | ||
lineColor, | ||
}: Props) => { | ||
const lineSymbol = stationNumberRaw.split('-')[0] | ||
const stationNumber = stationNumberRaw.split('-')[1] | ||
|
||
if (size === NUMBERING_ICON_SIZE.SMALL) { | ||
return ( | ||
<View style={[styles.rootTiny, { backgroundColor: lineColor }]}> | ||
<Typography style={styles.rootTinySymbol}>{lineSymbol}</Typography> | ||
</View> | ||
) | ||
} | ||
|
||
if (size === NUMBERING_ICON_SIZE.MEDIUM) { | ||
return ( | ||
<View style={[styles.rootMedium, { backgroundColor: lineColor }]}> | ||
<Typography style={styles.mediumLineSymbol}>{lineSymbol}</Typography> | ||
</View> | ||
) | ||
} | ||
|
||
return ( | ||
<View | ||
style={[ | ||
styles.root, | ||
{ | ||
borderColor: lineColor, | ||
}, | ||
]} | ||
> | ||
<View style={styles.lineSymbolContainer}> | ||
<Typography style={[styles.lineSymbol, { color: lineColor }]}> | ||
{lineSymbol} | ||
</Typography> | ||
</View> | ||
<View style={[styles.divider, { backgroundColor: lineColor }]} /> | ||
<View style={[styles.stationNumberBg, { backgroundColor: lineColor }]}> | ||
<Typography style={styles.stationNumber}>{stationNumber}</Typography> | ||
</View> | ||
</View> | ||
) | ||
} | ||
|
||
export default NumberingIconIzuhakone |
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