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

Commit

Permalink
Reuse 'LayoutSingleColumn' component on homepage and profile page
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtnzlml committed Jun 18, 2018
1 parent a8debbb commit 3fd026d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
8 changes: 4 additions & 4 deletions app/core/src/screens/homepage/Homepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import * as React from 'react';
import { View } from 'react-native';
import { TextButton } from '@kiwicom/mobile-shared';
import { TextButton, LayoutSingleColumn } from '@kiwicom/mobile-shared';
import { type NavigationType } from '@kiwicom/mobile-navigation';
import {
Translation,
Expand All @@ -11,7 +11,7 @@ import {
} from '@kiwicom/mobile-localization';

type Props = {|
navigation: NavigationType,
+navigation: NavigationType,
|};

function Section({ children }: { children: React.Node }) {
Expand Down Expand Up @@ -75,7 +75,7 @@ export default class Homepage extends React.Component<Props> {

render = () => {
return (
<React.Fragment>
<LayoutSingleColumn>
<Section>
<TextButton
title={<Translation passThrough="Hotels" />}
Expand Down Expand Up @@ -108,7 +108,7 @@ export default class Homepage extends React.Component<Props> {
onPress={this.searchWithDates}
/>
</Section>
</React.Fragment>
</LayoutSingleColumn>
);
};
}
8 changes: 2 additions & 6 deletions app/hotels/src/singleHotel/roomList/RoomList.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// @flow

import * as React from 'react';
import { View } from 'react-native';
import { createFragmentContainer, graphql } from '@kiwicom/mobile-relay';
import { StyleSheet, Text, Color } from '@kiwicom/mobile-shared';
import { Translation } from '@kiwicom/mobile-localization';
Expand Down Expand Up @@ -31,7 +30,7 @@ class RoomList extends React.Component<Props> {
const data = this.props.data || [];

return (
<View style={styles.wrapper}>
<React.Fragment>
<Text style={styles.title}>
<Translation id="single_hotel.room_list.rooms" />
</Text>
Expand All @@ -45,15 +44,12 @@ class RoomList extends React.Component<Props> {
openGallery={openGallery}
/>
))}
</View>
</React.Fragment>
);
};
}

const styles = StyleSheet.create({
wrapper: {
flex: 1,
},
title: {
fontSize: 14,
color: Color.textLight,
Expand Down
12 changes: 7 additions & 5 deletions app/profile/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import * as React from 'react';
import { AsyncStorage, Alert } from 'react-native';
import { SimpleCard } from '@kiwicom/mobile-shared';
import { SimpleCard, LayoutSingleColumn } from '@kiwicom/mobile-shared';

import Login from './components/authentication/Login';
import Logout from './components/authentication/Logout';
Expand All @@ -21,10 +21,12 @@ export default class LoginScreen extends React.Component<{||}> {

render = () => {
return (
<SimpleCard>
<Login onLogin={this.onLogin} />
<Logout onLogout={this.onLogout} />
</SimpleCard>
<LayoutSingleColumn>
<SimpleCard>
<Login onLogin={this.onLogin} />
<Logout onLogout={this.onLogout} />
</SimpleCard>
</LayoutSingleColumn>
);
};
}
1 change: 1 addition & 0 deletions packages/shared/src/view/LayoutSingleColumn.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Props = {|
*/
export default function LayoutSingleColumn(props: Props) {
const innerStyle = {
width: '100%',
maxWidth: Device.getWideDeviceThreshold(),
};

Expand Down

0 comments on commit 3fd026d

Please sign in to comment.