Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit de57bb3

Browse files
Dynamically resize Home's balance label.
1 parent 436fe23 commit de57bb3

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed

src/component/label.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ const balanceStyles = StyleSheet.create({
1515
numeral: {
1616
fontFamily: 'WorkSans ExtraLight',
1717
fontSize: font.sizeXXXL,
18-
lineHeight: font.lineHeightXXXL,
18+
lineHeight: null,
19+
marginLeft: 10,
20+
marginRight: 10,
1921
},
2022
unit: {
2123
fontFamily: 'WorkSans Regular',
2224
fontSize: font.sizeL,
23-
lineHeight: 60,
24-
marginLeft: 10,
25+
paddingTop: 5,
26+
marginRight: 10,
2527
},
2628
});
2729

@@ -35,7 +37,13 @@ BalanceLabel.propTypes = {
3537
};
3638

3739
export const BalanceLabelNumeral = ({ children, style }) => (
38-
<Text style={[balanceStyles.numeral, style]}>{children}</Text>
40+
<Text
41+
style={[balanceStyles.numeral, style]}
42+
adjustsFontSizeToFit={true}
43+
numberOfLines={1}
44+
>
45+
{children}
46+
</Text>
3947
);
4048

4149
BalanceLabelNumeral.propTypes = {

src/view/home.js

+20-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import PropTypes from 'prop-types';
55
import Background from '../component/background';
66
import MainContent from '../component/main-content';
77
import { Header, Title } from '../component/header';
8-
import { color } from '../component/style';
8+
import { createStyles, maxWidth } from '../component/media-query';
9+
import { color, breakWidth, smallBreakWidth } from '../component/style';
910
import { H4Text } from '../component/text';
1011
import Icon from '../component/icon';
1112
import ChannelIcon from '../asset/icon/channel';
@@ -83,7 +84,7 @@ HomeView.propTypes = {
8384
// Balance Display
8485
//
8586

86-
const balanceStyles = StyleSheet.create({
87+
const baseBalanceStyles = {
8788
wrapper: {
8889
flex: 1,
8990
justifyContent: 'center',
@@ -92,7 +93,23 @@ const balanceStyles = StyleSheet.create({
9293
marginTop: 30,
9394
marginBottom: 5,
9495
},
95-
});
96+
};
97+
98+
const balanceStyles = createStyles(
99+
baseBalanceStyles,
100+
101+
maxWidth(breakWidth, {
102+
wrapper: {
103+
width: 350,
104+
},
105+
}),
106+
107+
maxWidth(smallBreakWidth, {
108+
wrapper: {
109+
width: 250,
110+
},
111+
})
112+
);
96113

97114
const BalanceDisplay = ({
98115
depositLabel,

0 commit comments

Comments
 (0)