Skip to content

Commit 3de6171

Browse files
committed
change search to new cards
1 parent ce49ce8 commit 3de6171

File tree

12 files changed

+47
-41
lines changed

12 files changed

+47
-41
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"start:fast": "lerna run start --scope app --stream",
1616
"start:vscode": "VSCODE=1 yarn start:fast & cd standalone-packages/monaco-editor && yarn simpleserver & cd standalone-packages/vscode && yarn watch",
1717
"start:dynamic": "lerna run dev --scope dynamic-pages --stream",
18+
"start:common": "lerna run start --scope common --stream",
1819
"start:home": "lerna run start --scope homepage --stream",
1920
"start:test": "lerna run start:test --scope app --stream",
2021
"start:dev_api": "lerna run start:dev_api --scope app --stream",

packages/app/src/app/pages/Search/ResultInfo/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import { ClearAllContainer } from './elements';
66
function ResultInfo() {
77
return (
88
<div style={{ marginBottom: '1rem', fontSize: '.875rem' }}>
9-
<Stats />
9+
<Stats
10+
translations={{
11+
stats: nbHits => `${nbHits.toLocaleString()} results found`,
12+
}}
13+
/>
1014
<ClearAllContainer>
1115
<ClearRefinements />
1216
</ClearAllContainer>

packages/app/src/app/pages/Search/Results/index.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,30 @@ import React from 'react';
22

33
import { Hits, Pagination } from 'react-instantsearch/dom';
44
import Centered from '@codesandbox/common/lib/components/flex/Centered';
5+
import WideSandbox from '@codesandbox/common/lib/components/WideSandbox';
6+
import { sandboxUrl } from '@codesandbox/common/lib/utils/url-generator';
57

68
import ResultInfo from '../ResultInfo';
7-
import SandboxCard from '../SandboxCard';
8-
99
import { Container } from './elements';
1010

1111
function Results() {
1212
return (
1313
<Container>
1414
<ResultInfo />
15-
<Hits hitComponent={SandboxCard} />
15+
<Hits
16+
hitComponent={({ hit }) => (
17+
<WideSandbox
18+
selectSandbox={() =>
19+
window.open(sandboxUrl({ id: hit.objectID, git: hit.git }))
20+
}
21+
sandbox={{
22+
...hit,
23+
title: hit.title || hit.objectID,
24+
id: hit.objectID,
25+
}}
26+
/>
27+
)}
28+
/>
1629
<Centered horizontal>
1730
<Pagination />
1831
</Centered>

packages/app/src/app/pages/Search/SandboxCard/SandboxInfo/Stat/elements.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

packages/app/src/app/pages/Search/SandboxCard/SandboxInfo/Stat/index.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

packages/app/src/app/pages/Search/search.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,3 +350,16 @@
350350
appearance: none;
351351
border: 1px solid rgba(0, 0, 0, 0.1);
352352
}
353+
354+
.ais-Hits .ais-Hits-list {
355+
display: grid;
356+
grid-gap: 2rem;
357+
grid-template-columns: 400px 1fr;
358+
margin-top: 2rem;
359+
}
360+
361+
@media screen and (max-width: 1100px) {
362+
.ais-Hits-list {
363+
grid-template-columns: 1fr;
364+
}
365+
}

packages/common/src/components/WideSandbox/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export type Props = {
3434
small?: boolean;
3535
defaultHeight?: number;
3636
noMargin?: boolean;
37-
pickSandbox: (
37+
selectSandbox: (
3838
params: {
3939
id: string;
4040
title: string;
@@ -66,7 +66,7 @@ export default class WideSandbox extends React.PureComponent<Props> {
6666
};
6767

6868
toggleOpen = () => {
69-
this.props.pickSandbox({
69+
this.props.selectSandbox({
7070
id: this.props.sandbox.id,
7171
title: this.getTitle(),
7272
description: this.getDescription(),

packages/dynamic-pages/pages/profile/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const Profile = ({ profile, liked, showcased }) =>
5555
noMargin
5656
small
5757
key={sandbox.id}
58-
pickSandbox={({ id }) => openSandbox(id)}
58+
selectSandbox={({ id }) => openSandbox(id)}
5959
sandbox={sandbox}
6060
/>
6161
))}
@@ -86,7 +86,7 @@ const Profile = ({ profile, liked, showcased }) =>
8686
defaultHeight={170}
8787
small
8888
key={sandbox.id}
89-
pickSandbox={({ id }) => openSandbox(id)}
89+
selectSandbox={({ id }) => openSandbox(id)}
9090
sandbox={sandbox}
9191
/>
9292
))}

packages/dynamic-pages/pages/user-sandboxes/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ const Sandboxes = ({ data, fetchUrl, profile, currentTab }) => {
105105
<WideSandbox
106106
small
107107
key={sandbox.id}
108-
pickSandbox={({ id }) => openSandbox(id)}
108+
selectSandbox={({ id }) => openSandbox(id)}
109109
sandbox={sandbox}
110110
/>
111111
))}

packages/homepage/src/pages/explore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ export default class Explore extends React.PureComponent {
242242
// We force i here so we reuse the existing components
243243
// eslint-disable-next-line react/no-array-index-key,no-console
244244
key={i}
245-
pickSandbox={this.selectSandbox}
245+
selectSandbox={this.selectSandbox}
246246
sandbox={sandbox}
247247
/>
248248
))

0 commit comments

Comments
 (0)