Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
Hotels: Update ScorePopup with new design
Browse files Browse the repository at this point in the history
Shared: Delete SliderLabels
closes #1598
  • Loading branch information
tbergquist-godaddy authored and RobinCsl committed May 3, 2019
1 parent 1378e1c commit 086b5e7
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 435 deletions.
55 changes: 30 additions & 25 deletions app/hotels/src/filter/score/ScorePopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
ButtonPopup,
Slider,
StyleSheet,
SliderLabels,
Translation,
AdaptableBadge,
} from '@kiwicom/mobile-shared';
import { defaultTokens } from '@kiwicom/mobile-orbit';
import { SafeAreaView } from 'react-navigation';
Expand All @@ -29,6 +29,14 @@ const convertScoreToSliderValue = (minScore: number | null) => {
return minScore ? minScore - SLIDER_SHIFT : 0;
};

const labels = {
'0': <Translation id="hotels_search.filter.score_filter.rating.any" />,
'1': <Translation id="hotels_search.filter.score_filter.rating.6" />,
'2': <Translation id="hotels_search.filter.score_filter.rating.7" />,
'3': <Translation id="hotels_search.filter.score_filter.rating.8" />,
'4': <Translation id="hotels_search.filter.score_filter.rating.9" />,
};

export default class ScorePopup extends React.Component<Props, State> {
state = {
sliderValue: 0,
Expand All @@ -52,20 +60,6 @@ export default class ScorePopup extends React.Component<Props, State> {
return value ? value + SLIDER_SHIFT : null;
};

renderLabel = (sliderValue: number) => {
const labels = [
<Translation
key="any"
id="hotels_search.filter.score_filter.rating.any"
/>,
<Translation key="6" id="hotels_search.filter.score_filter.rating.6" />,
<Translation key="7" id="hotels_search.filter.score_filter.rating.7" />,
<Translation key="8" id="hotels_search.filter.score_filter.rating.8" />,
<Translation key="9" id="hotels_search.filter.score_filter.rating.9" />,
];
return labels[sliderValue];
};

render() {
return (
<SafeAreaView>
Expand All @@ -77,22 +71,26 @@ export default class ScorePopup extends React.Component<Props, State> {
onClose={this.props.onClose}
isVisible={this.props.isVisible}
>
<Text style={styles.title}>
<Translation id="hotels_search.filter.score_filter.rating" />
</Text>
<SliderLabels
max={4}
min={0}
startLabel={this.renderLabel(this.state.sliderValue)}
startValue={this.state.sliderValue}
/>
<View style={styles.titleContainer}>
<Text style={styles.title}>
<Translation id="hotels_search.filter.score_filter.rating" />
</Text>
<AdaptableBadge
translation={labels[this.state.sliderValue]}
type="info"
circled={true}
style={styles.badge}
/>
</View>
<View style={styles.sliderContainer}>
<Slider
startValue={this.state.sliderValue}
min={0}
max={4}
onChange={this.handleScoreChanged}
snapped={true}
startLabel={labels[0]}
endLabel={labels[4]}
/>
</View>
</ButtonPopup>
Expand All @@ -106,10 +104,17 @@ const styles = StyleSheet.create({
color: defaultTokens.colorHeading,
fontSize: 16,
fontWeight: '500',
paddingTop: 15,
paddingBottom: 10,
marginEnd: 8,
},
sliderContainer: {
paddingHorizontal: 10,
},
titleContainer: {
flexDirection: 'row',
alignItems: 'center',
},
badge: {
paddingHorizontal: 7,
},
});
1 change: 0 additions & 1 deletion packages/shared/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export { default as Translation } from './src/Translation';
export { default as TranslationFragment } from './src/TranslationFragment';
export { default as Duration } from './src/Duration';

export { default as SliderLabels } from './src/forms/SliderLabels';
export { default as OfflineScreen } from './src/offlineScreen/OfflineScreen';
export {
default as StatusbarBackground,
Expand Down
109 changes: 0 additions & 109 deletions packages/shared/src/forms/SliderLabels.js

This file was deleted.

Loading

0 comments on commit 086b5e7

Please sign in to comment.