Skip to content

Commit

Permalink
feat(server): project list design
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed Nov 9, 2019
1 parent 4d268a7 commit 04126b8
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 15 deletions.
45 changes: 45 additions & 0 deletions packages/server/src/ui/routes/project-list/project-list.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* @license Copyright 2019 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

.project-list {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;

height: calc(100vh - var(--page-header-height) - var(--base-spacing) * 2);

text-align: center;
}

.project-list .paper {
max-width: 50vw;
padding: calc(var(--base-spacing) * 2);
}

.project-list img {
width: 80px;
margin-bottom: calc(var(--base-spacing) * 2);
}

.project-list ul {
list-style: none;
padding: 0;
}

.project-list li {
font-size: var(--header-font-size);
padding: var(--base-spacing);
}

.project-list li a {
color: var(--base-text-color);
text-decoration: none;
}

.project-list li a:hover {
color: var(--compare-color);
}
42 changes: 27 additions & 15 deletions packages/server/src/ui/routes/project-list/project-list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,33 @@ import {AsyncLoader} from '../../components/async-loader';
import {Link} from 'preact-router';
import {Page} from '../../layout/page';
import {DocumentTitle} from '../../components/document-title';
import './project-list.css';
import {Paper} from '../../components/paper';

// @ts-ignore - tsc doesn't get parcel :)
const LH_LOGO_PATH = require('../../logo.svg');

const NoProjects = () => {
return <span>No projects yet, create one by running `lhci wizard`</span>;
};

/** @param {{projects: Array<LHCI.ServerCommand.Project>}} props */
const ProjectList_ = ({projects}) => {
if (!projects.length) {
return <span>No projects yet, create one by running `lhci wizard`</span>;
return <NoProjects />;
}

return (
<ul>
{projects.map(project => (
<li key={project.id}>
<Link href={`/app/projects/${project.slug}`}>
{project.name} ({project.externalUrl})
</Link>
</li>
))}
</ul>
<Paper>
<img src={LH_LOGO_PATH} />
<ul>
{projects.map(project => (
<li key={project.id}>
<Link href={`/app/projects/${project.slug}`}>{project.name}</Link>
</li>
))}
</ul>
</Paper>
);
};

Expand All @@ -36,11 +46,13 @@ export const ProjectList = () => {
return (
<Page>
<DocumentTitle title="Projects" />
<AsyncLoader
loadingState={loadingState}
asyncData={projects}
render={projects => <ProjectList_ projects={projects} />}
/>
<div className="project-list">
<AsyncLoader
loadingState={loadingState}
asyncData={projects}
render={projects => <ProjectList_ projects={projects} />}
/>
</div>
</Page>
);
};

0 comments on commit 04126b8

Please sign in to comment.