Skip to content

Commit 98602a6

Browse files
JonShortCompuIves
authored andcommitted
Fix frameworks text overflowing (codesandbox#1746)
- Allow framework icons to be scrolled by user - Fix frameworks title / description from flowing off the screen horizontally
1 parent 082ecbf commit 98602a6

File tree

1 file changed

+33
-20
lines changed
  • packages/homepage/src/screens/home/Frameworks

1 file changed

+33
-20
lines changed

packages/homepage/src/screens/home/Frameworks/index.js

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,25 @@ const Intro = styled(Column)`
8989
`;
9090

9191
const Icons = styled.div`
92-
display: flex;
93-
justify-content: space-around;
9492
margin-top: 1rem;
9593
margin-bottom: 4rem;
96-
flex: 1;
9794
min-width: 100%;
9895
9996
${media.phone`
10097
margin: 2rem 0;
98+
width: 100%;
99+
`};
100+
`;
101+
102+
const ScrollAtMobile = styled.div`
103+
display: flex;
104+
flex: 1;
105+
justify-content: space-around;
106+
min-width: 100%;
107+
108+
${media.phone`
109+
justify-content: flex-start;
110+
overflow-x: scroll;
101111
`};
102112
`;
103113

@@ -115,6 +125,7 @@ const IconContainer = styled.div`
115125
}
116126
117127
${media.phone`
128+
flex-shrink: 0;
118129
width: 96px;
119130
height: 96px;
120131
@@ -285,23 +296,25 @@ export default class Frameworks extends React.Component {
285296
<Pane width={1280}>
286297
<Flex>
287298
<Icons>
288-
{templates.map(({ name }, i) => {
289-
const TIcon = getIcon(name);
290-
291-
return (
292-
<IconContainer
293-
// eslint-disable-next-line
294-
key={i}
295-
selected={templates[i] === template}
296-
template={templates[i]}
297-
onClick={() => {
298-
this.setTemplate(templates[i]);
299-
}}
300-
>
301-
<TIcon width={80} height={80} />
302-
</IconContainer>
303-
);
304-
})}
299+
<ScrollAtMobile>
300+
{templates.map(({ name }, i) => {
301+
const TIcon = getIcon(name);
302+
303+
return (
304+
<IconContainer
305+
// eslint-disable-next-line
306+
key={i}
307+
selected={templates[i] === template}
308+
template={templates[i]}
309+
onClick={() => {
310+
this.setTemplate(templates[i]);
311+
}}
312+
>
313+
<TIcon width={80} height={80} />
314+
</IconContainer>
315+
);
316+
})}
317+
</ScrollAtMobile>
305318
</Icons>
306319

307320
<Intro style={{ marginRight: '2rem' }}>

0 commit comments

Comments
 (0)