Skip to content

Commit

Permalink
add SortButtons component
Browse files Browse the repository at this point in the history
used in /cv to sort repos/papers by date/title/commits/stars/author
update deps + commit hooks
  • Loading branch information
janosh committed Feb 25, 2024
1 parent c59cd12 commit 743b8d0
Show file tree
Hide file tree
Showing 14 changed files with 254 additions and 140 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Expand Up @@ -37,7 +37,7 @@ repos:
args: [--ignore-words-list, 'ist,yau,te,manuel', --check-filenames]

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.0.0-alpha.0
rev: v9.0.0-beta.1
hooks:
- id: eslint
types: [file]
Expand Down
22 changes: 11 additions & 11 deletions package.json
Expand Up @@ -29,34 +29,34 @@
"@iconify/svelte": "^3.1.6",
"@rollup/plugin-yaml": "^4.1.2",
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "^2.5.0",
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@typescript-eslint/eslint-plugin": "^6.19.1",
"@typescript-eslint/parser": "^6.19.1",
"@sveltejs/kit": "^2.5.1",
"@sveltejs/vite-plugin-svelte": "^3.0.2",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"devalue": "^4.3.2",
"elementari": "^0.2.3",
"eslint": "^8.56.0",
"eslint": "^8.57.0",
"eslint-plugin-svelte": "^2.35.1",
"hast-util-from-string": "^3.0.0",
"hast-util-select": "^6.0.2",
"hastscript": "^9.0.0",
"js-yaml": "^4.1.0",
"katex": "^0.16.9",
"mdsvex": "^0.11.0",
"prettier": "^3.2.4",
"prettier-plugin-svelte": "^3.1.2",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.1",
"rehype-autolink-headings": "^7.1.0",
"rehype-katex-svelte": "^1.2.0",
"rehype-slug": "^6.0.0",
"remark-math": "3.0.0",
"svelte": "^4.2.9",
"svelte-check": "^3.6.3",
"svelte": "^4.2.12",
"svelte-check": "^3.6.4",
"svelte-multiselect": "^10.2.0",
"svelte-preprocess": "^5.1.3",
"svelte-preprocess-import-assets": "^1.1.0",
"svelte-zoo": "^0.4.10",
"svelte2tsx": "^0.7.0",
"svelte2tsx": "^0.7.1",
"typescript": "^5.3.3",
"vite": "^5.0.12"
"vite": "^5.1.4"
}
}
2 changes: 1 addition & 1 deletion src/app.d.ts
Expand Up @@ -10,7 +10,7 @@ declare module '*cv.yml' {
education: types.Education[]
skills: types.Skill[]
hobbies: types.Hobby[]
nationality: string[]
nationality: { title: string; icon: string }[]
languages: types.Language[]
volunteer: types.Volunteer[]
awards: types.Award[]
Expand Down
5 changes: 5 additions & 0 deletions src/lib/Footer.svelte
Expand Up @@ -30,4 +30,9 @@
border-radius: 50%;
transform: scale(1.4);
}
@media print {
:is(button, footer) {
display: none;
}
}
</style>
50 changes: 50 additions & 0 deletions src/lib/SortButtons.svelte
@@ -0,0 +1,50 @@
<script lang="ts">
export let label: string = `Sort by`
export { className as class }
export let sort_by: string | undefined = undefined
export let sort_keys: readonly string[] = []
export let sort_order: 'asc' | 'desc' = `asc`
export let as: string = `small`
export let style: string | null = null
let className: string | null = null
</script>

<svelte:element this={as} class="sort-buttons {className}" {style}>
{label}
{#each sort_keys as key}
<button on:click={() => (sort_by = key)} class:active={sort_by === key}>
{key}
</button>
{/each}
<button on:click={() => (sort_order = sort_order === `asc` ? `desc` : `asc`)}>
{sort_order === `asc` ? `` : ``}
</button>
</svelte:element>

<style>
.sort-buttons {
display: flex;
gap: 2pt;
position: absolute;
right: 0;
bottom: 4pt;
font-weight: 100;
font-size: 9pt;
}
.sort-buttons button {
font-size: 9pt;
padding: 1pt 2pt;
border: none;
color: gray;
background-color: #f0f0f0;
}
.sort-buttons button.active {
background-color: #e0e0e0;
}
@media print {
.sort-buttons {
display: none;
}
}
</style>
1 change: 1 addition & 0 deletions src/lib/index.ts
@@ -1,5 +1,6 @@
export { default as DocsGrid } from './DocsGrid.svelte'
export { default as Footer } from './Footer.svelte'
export { default as Nav } from './Nav.svelte'
export { default as SortButtons } from './SortButtons.svelte'

export type * from './types'
44 changes: 22 additions & 22 deletions src/lib/oss.yml
Expand Up @@ -9,8 +9,8 @@ projects:
- Python
- Cython
- Jupyter Notebook
stars: 1257
commits: 931
stars: 1263
commits: 947
- name: Matbench Discovery
url: https://matbench-discovery.materialsproject.org
img_style: 'filter: invert(1);'
Expand All @@ -24,8 +24,8 @@ projects:
- TypeScript
- JavaScript
- HTML
stars: 52
commits: 308
stars: 55
commits: 315
- name: CHGNet
url: https://chgnet.lbl.gov
repo: https://github.com/CederGroupHub/chgnet
Expand All @@ -41,16 +41,16 @@ projects:
- HTML
- JavaScript
- TypeScript
stars: 164
commits: 167
stars: 173
commits: 169
- name: MACE
url: https://mace-docs.readthedocs.io
repo: https://github.com/ACEsuit/mace
role: Contributor
paper: riebesell_foundation_2023
description: Fast and accurate machine learning interatomic potentials with higher order equivariant message passing.
logo: https://avatars.githubusercontent.com/u/68508620
stars: 296
stars: 309
commits: 21
languages:
- Python
Expand All @@ -66,7 +66,7 @@ projects:
- Python
- JavaScript
- HTML
stars: 109
stars: 111
commits: 174
- name: pymatviz
url: https://pymatviz.janosh.dev
Expand All @@ -80,8 +80,8 @@ projects:
- TypeScript
- HTML
- JavaScript
stars: 101
commits: 235
stars: 104
commits: 237
- name: Tensorboard Reducer
repo: https://github.com/janosh/tensorboard-reducer
logo: https://raw.githubusercontent.com/janosh/tensorboard-reducer/main/assets/tensorboard-reducer-square.svg
Expand All @@ -98,7 +98,7 @@ projects:
description: Curated list of resources for learning and using normalizing flows, a powerful tool in ML for modeling probability distributions.
languages:
- Python
stars: 1252
stars: 1260
commits: 72
- name: atomate2
repo: https://github.com/materialsproject/atomate2
Expand All @@ -110,8 +110,8 @@ projects:
potential-powered structure relaxation workflows.
languages:
- Python
stars: 113
commits: 349
stars: 116
commits: 353
- name: jobflow
repo: https://github.com/materialsproject/jobflow
role: Maintainer
Expand All @@ -122,7 +122,7 @@ projects:
languages:
- Python
- TeX
stars: 77
stars: 80
commits: 100
- name: Aviary
repo: https://github.com/CompRhys/aviary
Expand All @@ -132,8 +132,8 @@ projects:
pypi: https://pypi.org/project/tensorboard-reducer
languages:
- Python
stars: 36
commits: 233
stars: 38
commits: 234
- name: MatCalc
url: https://materialsvirtuallab.github.io/matcalc
logo: https://github.com/materialsvirtuallab/matcalc/assets/30958850/89486f2f-73fb-40fb-803a-dfafe510eb6d
Expand All @@ -142,8 +142,8 @@ projects:
description: A Python library for calculating materials properties from ML force field potential energy surfaces.
languages:
- Python
stars: 37
commits: 66
stars: 39
commits: 67
- name: TikZ
url: https://tikz.janosh.dev
repo: https://github.com/janosh/tikz
Expand All @@ -165,7 +165,7 @@ projects:
description: Pushing the Pareto front of band gap and permittivity with ML-guided dielectrics discovery incl. experimental synthesis.
logo: https://github.com/janosh/tikz/raw/main/assets/plate-capacitor/plate-capacitor.svg
paper: riebesell_pushing_2024
stars: 6
stars: 7
commits: 12
languages:
- Python
Expand All @@ -179,7 +179,7 @@ projects:
- TypeScript
- Svelte
- CSS
- HTML
- JavaScript
stars: 247
commits: 269
- HTML
stars: 251
commits: 270
2 changes: 1 addition & 1 deletion src/lib/papers.yaml
Expand Up @@ -459,7 +459,7 @@ references:
publisher: arXiv
source: arXiv.org
title: >-
Matbench Discovery -- An evaluation framework for machine learning crystal
Matbench Discovery - An evaluation framework for machine learning crystal
stability prediction
URL: http://arxiv.org/abs/2308.14920

Expand Down
1 change: 1 addition & 0 deletions src/lib/types.ts
Expand Up @@ -94,4 +94,5 @@ export type Membership = {
export type Language = {
name: string
level: string
icon: string
}
15 changes: 11 additions & 4 deletions src/routes/+layout.svelte
Expand Up @@ -11,7 +11,7 @@
const parts = filename.split(`/`).filter((part) => !part.startsWith(`(`)) // remove hidden route segments
const route = `/${parts.slice(1, -1).join(`/`)}`
return { label: route, action: () => goto(route) }
}
},
)
afterNavigate(() => {
Expand All @@ -34,16 +34,18 @@
<CmdPalette {actions} placeholder="Go to..." />

{#if $page.url.pathname !== `/`}
<a href="/" aria-label="Back to index page">&laquo; home</a>
<a href="/" aria-label="Back to index page">&larr; home</a>
{/if}

<slot />

<Footer />
{#if $page.url.pathname !== `/cv`}
<Footer />
{/if}

<style>
a[href='/'] {
font-size: 15pt;
font-size: 14pt;
position: absolute;
top: 2em;
left: 2em;
Expand All @@ -52,4 +54,9 @@
border-radius: 3pt;
transition: 0.2s;
}
@media print {
a[href='/'] {
display: none;
}
}
</style>

0 comments on commit 743b8d0

Please sign in to comment.