Skip to content

Commit 615b87a

Browse files
committed
Change how we show templates on homepage
1 parent 1a5e7e9 commit 615b87a

File tree

5 files changed

+64
-26
lines changed

5 files changed

+64
-26
lines changed

packages/common/src/templates/gatsby.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ export default new Template(
1818
showOnHomePage: true,
1919
main: true,
2020
popular: true,
21+
showCube: false,
2122
}
2223
);

packages/common/src/templates/next.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import Template from './template';
32
import { decorateSelector } from '../theme';
43
import configurations from './configuration';
@@ -21,5 +20,6 @@ export default new Template(
2120
showOnHomePage: true,
2221
main: true,
2322
popular: true,
23+
showCube: false,
2424
}
2525
);

packages/common/src/templates/nuxt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import Template from './template';
32
import { decorateSelector } from '../theme';
43
import configurations from './configuration';
@@ -19,5 +18,6 @@ export default new Template(
1918
mainFile: ['/pages/index.vue'],
2019
showOnHomePage: true,
2120
main: true,
21+
showCube: false,
2222
}
2323
);

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import {
1010
angular,
1111
vue,
1212
react,
13-
preact,
14-
svelte,
1513
parcel,
16-
cxjs,
17-
dojo,
14+
gatsby,
15+
nuxt,
16+
next,
1817
} from '@codesandbox/common/lib/templates';
1918

2019
import Background from './Background';
@@ -65,7 +64,7 @@ const Message = styled.h2`
6564
`};
6665
`;
6766

68-
const TEMPLATES = [parcel, react, vue, angular, preact, svelte, cxjs, dojo];
67+
const TEMPLATES = [parcel, react, vue, angular, gatsby, nuxt, next];
6968

7069
export default class Animation extends React.PureComponent {
7170
state = {

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

Lines changed: 57 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ import MaxWidth from '@codesandbox/common/lib/components/flex/MaxWidth';
55
import Column from '@codesandbox/common/lib/components/flex/Column';
66
import Centered from '@codesandbox/common/lib/components/flex/Centered';
77
import Padding from '@codesandbox/common/lib/components/spacing/Padding';
8-
98
import theme from '@codesandbox/common/lib/theme';
109
import getIcon from '@codesandbox/common/lib/templates/icons';
10+
import Tooltip from '@codesandbox/common/lib/components/Tooltip';
11+
12+
import ChevronRight from 'react-icons/lib/md/chevron-right';
1113

1214
import LoadInView from '../../../components/LoadInView';
1315
import RollingText from '../../../components/RollingText';
@@ -148,6 +150,7 @@ const IconContainer = styled.div`
148150
149151
${({ selected, template }) =>
150152
selected &&
153+
template &&
151154
css`
152155
background-color: ${template.color.clearer(0.9)};
153156
@@ -213,6 +216,7 @@ const CSSTypes = styled.div`
213216
font-size: 0.875rem;
214217
color: white;
215218
margin-top: 0.5rem;
219+
margin-right: 1rem;
216220
`;
217221

218222
const TEMPLATE_SUPPORT = {
@@ -290,6 +294,11 @@ export default class Frameworks extends React.Component {
290294
render() {
291295
const { templates } = this.props;
292296
const template = templates[this.state.templateIndex];
297+
const additionalInfo = TEMPLATE_SUPPORT[template.name] || {
298+
loaders: [],
299+
css: [],
300+
description: `Used for ${template.niceName} development, based on: `,
301+
};
293302
const TemplateIcon = getIcon(template.name);
294303

295304
return (
@@ -314,6 +323,20 @@ export default class Frameworks extends React.Component {
314323
</IconContainer>
315324
);
316325
})}
326+
327+
<Tooltip
328+
delay={0}
329+
placement="bottom"
330+
content="Check out other templates"
331+
>
332+
<IconContainer
333+
onClick={() => {
334+
window.open('/s', '_blank');
335+
}}
336+
>
337+
<ChevronRight width={56} height={56} />
338+
</IconContainer>
339+
</Tooltip>
317340
</ScrollAtMobile>
318341
</Icons>
319342

@@ -350,7 +373,7 @@ export default class Frameworks extends React.Component {
350373
fontSize: '.875rem',
351374
}}
352375
>
353-
{TEMPLATE_SUPPORT[template.name].description}
376+
{additionalInfo.description}
354377
<a
355378
href={template.url}
356379
target="_blank"
@@ -362,23 +385,38 @@ export default class Frameworks extends React.Component {
362385
.
363386
</div>
364387

365-
<HeaderTitle>Supported Loaders</HeaderTitle>
366-
<TemplateIcons>
367-
{TEMPLATE_SUPPORT[template.name].loaders.map((data, i) => (
368-
<FileType
369-
key={template.name + data.title}
370-
iconSrc={data.svg}
371-
title={data.title}
372-
extension={data.extension}
373-
i={i}
374-
/>
375-
))}
376-
</TemplateIcons>
377-
378-
<HeaderTitle>CSS Scoping Support</HeaderTitle>
379-
<CSSTypes>
380-
{TEMPLATE_SUPPORT[template.name].css.join(', ')}
381-
</CSSTypes>
388+
{additionalInfo.loaders.length > 0 && (
389+
<React.Fragment>
390+
<HeaderTitle>Supported Loaders</HeaderTitle>
391+
<TemplateIcons>
392+
{additionalInfo.loaders.map((data, i) => (
393+
<FileType
394+
key={template.name + data.title}
395+
iconSrc={data.svg}
396+
title={data.title}
397+
extension={data.extension}
398+
i={i}
399+
/>
400+
))}
401+
</TemplateIcons>
402+
</React.Fragment>
403+
)}
404+
405+
{additionalInfo.css.length > 0 && (
406+
<React.Fragment>
407+
<HeaderTitle>CSS Scoping Support</HeaderTitle>
408+
<CSSTypes>{additionalInfo.css.join(', ')}</CSSTypes>
409+
</React.Fragment>
410+
)}
411+
412+
{template.isServer && (
413+
<React.Fragment>
414+
<HeaderTitle>Container Support</HeaderTitle>
415+
<CSSTypes>
416+
For this template we run the code on a server.
417+
</CSSTypes>
418+
</React.Fragment>
419+
)}
382420
</Padding>
383421
</Container>
384422
</Flex>

0 commit comments

Comments
 (0)