Skip to content

Commit 0b51542

Browse files
committed
Little fixup
1 parent c6ae250 commit 0b51542

6 files changed

Lines changed: 34 additions & 61 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public/

src/categories.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export const CATEGORY_COLORS = {
2+
systems: '#ff6b6b',
3+
'general-purpose': '#4ecdc4',
4+
functional: '#a78bfa',
5+
scripting: '#fbbf24',
6+
web: '#60a5fa',
7+
historical: '#9ca3af',
8+
esoteric: '#f472b6',
9+
jvm: '#fb923c',
10+
shell: '#34d399',
11+
'ml-family': '#c084fc',
12+
}
13+
14+
export const CATEGORY_LANES = {
15+
historical: 0,
16+
systems: 1,
17+
'general-purpose': 2,
18+
functional: 3,
19+
'ml-family': 4,
20+
jvm: 5,
21+
scripting: 6,
22+
web: 7,
23+
shell: 8,
24+
esoteric: 9,
25+
}
26+
27+
export const CATEGORIES = Object.keys(CATEGORY_LANES)

src/components/LanguageCard.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
import React from 'react'
22
import { Link } from 'gatsby'
3-
4-
const CATEGORY_COLORS = {
5-
systems: '#ff6b6b',
6-
'general-purpose': '#4ecdc4',
7-
functional: '#a78bfa',
8-
scripting: '#fbbf24',
9-
web: '#60a5fa',
10-
historical: '#9ca3af',
11-
esoteric: '#f472b6',
12-
jvm: '#fb923c',
13-
shell: '#34d399',
14-
'ml-family': '#c084fc',
15-
}
3+
import { CATEGORY_COLORS } from '../categories'
164

175
const styles = {
186
card: {

src/components/TimelineGraph.js

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,13 @@
11
import React, { useRef, useEffect, useState, useCallback } from 'react'
22
import { navigate } from 'gatsby'
33
import '../styles/timeline.css'
4-
5-
const CATEGORY_COLORS = {
6-
systems: '#ff6b6b',
7-
'general-purpose': '#4ecdc4',
8-
functional: '#a78bfa',
9-
scripting: '#fbbf24',
10-
web: '#60a5fa',
11-
historical: '#9ca3af',
12-
esoteric: '#f472b6',
13-
jvm: '#fb923c',
14-
shell: '#34d399',
15-
'ml-family': '#c084fc',
16-
}
17-
18-
const CATEGORY_LANES = {
19-
historical: 0,
20-
systems: 1,
21-
'general-purpose': 2,
22-
functional: 3,
23-
'ml-family': 4,
24-
jvm: 5,
25-
scripting: 6,
26-
web: 7,
27-
shell: 8,
28-
esoteric: 9,
29-
}
30-
31-
const ALL_CATEGORIES = Object.keys(CATEGORY_LANES)
4+
import { CATEGORY_COLORS, CATEGORY_LANES, CATEGORIES } from '../categories'
325

336
export default function TimelineGraph({ languages }) {
347
const containerRef = useRef(null)
358
const svgRef = useRef(null)
369
const tooltipRef = useRef(null)
37-
const [activeCategories, setActiveCategories] = useState(new Set(ALL_CATEGORIES))
10+
const [activeCategories, setActiveCategories] = useState(new Set(CATEGORIES))
3811
const [dimensions, setDimensions] = useState({ width: 1200, height: 450 })
3912

4013
const toggleCategory = (cat) => {
@@ -255,7 +228,7 @@ export default function TimelineGraph({ languages }) {
255228
<span style={{ fontSize: '0.7rem', color: 'var(--text-muted)', fontFamily: "'JetBrains Mono', monospace", marginRight: '0.25rem' }}>
256229
filter
257230
</span>
258-
{ALL_CATEGORIES.map(cat => (
231+
{CATEGORIES.map(cat => (
259232
<button
260233
key={cat}
261234
className={`timeline-control-btn ${activeCategories.has(cat) ? 'active' : ''}`}

src/pages/index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ import Layout from '../components/Layout'
44
import SEO from '../components/SEO'
55
import LanguageCard from '../components/LanguageCard'
66
import TimelineGraph from '../components/TimelineGraph'
7-
8-
const CATEGORIES = [
9-
'systems', 'general-purpose', 'functional', 'scripting', 'web',
10-
'historical', 'esoteric', 'jvm', 'shell', 'ml-family',
11-
]
7+
import { CATEGORIES } from '../categories'
128

139
const s = {
1410
hero: {

src/templates/language.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,7 @@ import Layout from '../components/Layout'
44
import SEO from '../components/SEO'
55
import CopyableCode from '../components/CopyableCode'
66
import CopyableCommand from '../components/CopyableCommand'
7-
8-
const CATEGORY_COLORS = {
9-
systems: '#ff6b6b',
10-
'general-purpose': '#4ecdc4',
11-
functional: '#a78bfa',
12-
scripting: '#fbbf24',
13-
web: '#60a5fa',
14-
historical: '#9ca3af',
15-
esoteric: '#f472b6',
16-
jvm: '#fb923c',
17-
shell: '#34d399',
18-
'ml-family': '#c084fc',
19-
}
7+
import { CATEGORY_COLORS } from '../categories'
208

219
const s = {
2210
hero: {

0 commit comments

Comments
 (0)