This is a parody of leetcode.com for designers. It's being developed live on Twitch.tv/zedashaw to demonstrate how to make a parody of a website.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pixelperfectionist/client/pages/Problems.svelte

167 lines
4.0 KiB

<script>
import { push, link } from 'svelte-spa-router';
import Validator from 'Validator';
import { onMount } from 'svelte';
import Layout from '$/client/Layout.svelte';
import Blockstart from '$/client/components/Blockstart.svelte';
import Calendar from '$/client/components/Calendar.svelte';
import Icon from '$/client/components/Icon.svelte';
import api from "$/client/api.js";
let problem_set;
let companies_list = [];
onMount(async () => {
const [status, data] = await api.get("/api/problems");
if(status === 200) {
console.log("STATUS", status, "DATA", data);
problem_set = data.problems;
companies_list = data.companies;
} else {
console.error("Invalid response", status, data);
}
});
</script>
<style>
sidebar {
box-shadow: unset;
max-width: 300px;
min-width: 300px;
width: 300px;
gap: 20px;
}
card {
border: 1px solid var(--value8);
}
card * {
font-size: 1em;
background-color: var(--value9);
}
card > top,
card > bottom {
border: unset;
text-align: center;
}
table#problem-list {
font-size: 1em;
border: none;
}
table#problem-list > tr:nth-child(even) {
background-color: var(--value8);
}
table#problem-list a {
text-decoration: none;
}
table#problem-list a:hover {
text-decoration: underline;
}
company {
font-size: 0.8em;
border-radius: 20px;
background-color: var(--value8);
margin-bottom: 4px;
padding-left: 10px;
}
company count {
background-color: var(--yellow);
border-radius: 20px;
padding: 2px;
font-size: 0.7em;
}
</style>
<Layout centered={ true }>
<Blockstart>
<block class="horizontal">
<left>
<grid style="--cols: 2;">
<shape style="--gap: 10px; --h: 200px; --w: 200px;">Product</shape>
<shape style="--gap: 10px; --h: 200px; --w: 200px;">Product</shape>
<shape style="--gap: 10px; --h: 200px; --w: 200px;">Product</shape>
<shape style="--gap: 10px; --h: 200px; --w: 200px;">Product</shape>
</grid>
<hr>
<block style="--value: 7; --h: 300px;">
<h1>Junk</h1>
</block>
<hr>
<block class="horizontal">
<input type="text" placeholder="Search">
<button>Pick One</button>
</block>
<table id="problem-list">
<tr><th>Title</th><th>Solution</th><th>Acceptance</th></tr>
{#if problem_set}
{#each problem_set as problem}
<tr>
<td><a use:link href="/problem/{problem.id}/">{problem.title}</a></td>
<td><Icon name={problem.solution} /></td>
<td>{problem.acceptance}</td>
</tr>
{/each}
{/if}
</table>
</left>
<right>
<sidebar>
<tile>
<left><Icon name="calendar"/></left><middle>Study Plan</middle><right>&gt;</right>
</tile>
<card>
<top><h6>Featured Lists</h6></top>
<middle>
<tile>
<left><Icon name="laptop" size="36" /></left><middle>Study Plan</middle><right>&gt;</right>
</tile>
<tile>
<left><Icon name="calendar" size="36" /></left><middle>Study Plan</middle><right>&gt;</right>
</tile>
<tile>
<left><Icon name="facebook" size="36" /></left><middle>Study Plan</middle><right>&gt;</right>
</tile>
</middle>
<bottom>
<a href="/">Show More</a>
</bottom>
</card>
<shape style="--w: 300px; --h: 350px; --value: 7; --text: 1;">
Calendar
</shape>
<card>
<top><h6>Companies</h6></top>
<middle>
{#each companies_list as company}
<company>{company.name} <count>{company.count}</count></company>
{/each}
</middle>
<bottom>
<a href="/">Show More</a>
</bottom>
</card>
</sidebar>
</right>
</block>
</Blockstart>
</Layout>