Skip to content

Commit

Permalink
Fix Icon Support
Browse files Browse the repository at this point in the history
  • Loading branch information
consindo committed Sep 2, 2019
1 parent 88c20a9 commit 8f737e2
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 26 deletions.
26 changes: 6 additions & 20 deletions js/views/lines/LineList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@ class LineList extends React.Component {
loading: true,
meta: {},
error: null,
lines: undefined,
groups: [],
colors: {},
icons: {},
groupShow: {},
friendlyNames: {},
}

componentDidMount() {
Expand Down Expand Up @@ -66,26 +63,12 @@ class LineList extends React.Component {
data.groups.forEach(group => {
groupShow[group.name] = ''
})
const {
meta,
lines,
colors,
icons,
groups,
operators,
friendlyNames,
friendlyNumbers,
} = data
const { meta, icons, groups } = data

this.setState({
meta,
lines,
colors,
icons,
groups,
operators,
friendlyNames,
friendlyNumbers,
groupShow,
loading: false,
})
Expand Down Expand Up @@ -149,7 +132,8 @@ class LineList extends React.Component {
>
<Text style={styles.label}>{item.routeLongName}</Text>
<View>
{icons[item] === undefined ? (
{icons[`${item.agencyId}/${item.routeShortName}`] ===
undefined ? (
<Text
style={[
styles.pill,
Expand All @@ -164,7 +148,9 @@ class LineList extends React.Component {
<img
alt={item.routeLongName}
style={{ maxHeight: '28px', width: 'auto' }}
src={`/route_icons/${icons[item]}-color.svg`}
src={`/route_icons/${
icons[`${item.agencyId}/${item.routeShortName}`]
}-color.svg`}
/>
)}
</View>
Expand Down
3 changes: 2 additions & 1 deletion js/views/station/Station.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ class Station extends React.Component {
name = name.replace(' Train Station', '')
name = name.replace(' Ferry Terminal', '')
name = name.replace('- Cable Car Station', '')
name = name.replace(' Station', '')
return name
}

Expand Down Expand Up @@ -421,11 +420,13 @@ class Station extends React.Component {
route_color: routeColor,
route_id: routeId,
route_text_color: routeTextColor,
route_icon: routeIcon,
} = item[0]
return (
<TripItem
key={tripId}
routeShortName={routeShortName}
routeIcon={routeIcon}
direction={directionId}
color={routeColor}
textColor={routeTextColor}
Expand Down
29 changes: 24 additions & 5 deletions js/views/station/TripItemV2.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const getNextText = (times, hideVerb = false, amphersand = 'also') => {

export const TripItem = ({
routeShortName,
routeIcon,
color = headerColor,
textColor = '#fff',
direction,
Expand All @@ -92,9 +93,19 @@ export const TripItem = ({
<TouchableOpacity activeOpacity={0.85} onClick={onClick}>
<View style={[styles.wrapper, { backgroundColor: color }]}>
<View style={styles.left}>
<Text style={[styles.routeShortName, textColorStyles]}>
{routeShortName}
</Text>
{routeIcon ? (
<View style={styles.routeIcon}>
<img
alt={routeShortName}
style={{ maxHeight: '28px', width: 'auto' }}
src={`/route_icons/${routeIcon}-mono.svg`}
/>
</View>
) : (
<Text style={[styles.routeShortName, textColorStyles]}>
{routeShortName}
</Text>
)}
<View style={styles.destinations}>
<View
style={
Expand Down Expand Up @@ -201,9 +212,14 @@ styles = StyleSheet.create({
},
right: {
paddingRight: padding * 0.75,
display: 'block',
textAlign: 'right',
display: 'flex',
backgroundRepeat: 'no-repeat',
alignItems: 'flex-end',
},
routeIcon: {
alignItems: 'start',
paddingTop: 5,
paddingBottom: 3,
},
routeShortName: {
fontSize: 28,
Expand Down Expand Up @@ -234,6 +250,7 @@ styles = StyleSheet.create({
paddingTop: 2,
paddingRight: 1,
fontFamily,
textAlign: 'right',
},
departureTimeText: {
lineHeight: 30,
Expand Down Expand Up @@ -262,12 +279,14 @@ styles = StyleSheet.create({
letterSpacing: 0.5,
color: '#fff',
fontFamily,
textAlign: 'right',
},
strong: {
fontWeight: 'bold',
},
and: {
fontFamily,
fontSize: 13,
textAlign: 'right',
},
})
4 changes: 4 additions & 0 deletions scss/_leaflet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -643,3 +643,7 @@
}
}
}

.leaflet-marker-icon {
color: transparent;
}

0 comments on commit 8f737e2

Please sign in to comment.