Skip to content

Commit 68b1c27

Browse files
committed
UPDATE: mantine to bootstrap, tags page
1 parent f2bbfe8 commit 68b1c27

22 files changed

+4306
-3820
lines changed

.yarn/releases/yarn-4.4.1.cjs

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

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@ LATER
1616

1717
- [Wikipedia:Regular_Expression](https://en.wikipedia.org/wiki/Regular_expression)
1818
- [Cheatography Cheat Sheet](https://cheatography.com/davechild/cheat-sheets/regular-expressions/)
19+
- [aloisdg/awesome-regex](https://github.com/aloisdg/awesome-regex)
20+
- [slevithan/awesome-regex](https://github.com/slevithan/awesome-regex)
1921

20-
## Other Libraries of Regex Patterns
22+
## Other Collections of Regex Patterns
2123

2224
- [GitLeaks](https://github.com/gitleaks/gitleaks/blob/master/config/gitleaks.toml)
2325
- [iHateRegex](https://github.com/geongeorge/i-hate-regex/tree/master/static/regex)
2426
- [mingrammer/commonregex](https://github.com/mingrammer/commonregex)
2527
- [pyWhat](https://github.com/bee-san/pyWhat/blob/main/pywhat/Data/regex.json)
28+
- [RegexDB](https://rgxdb.com/)
2629
- [RegexHub](https://projects.lukehaas.me/regexhub/)
2730
- [RegExLib](https://regexlib.com/Default.aspx)
31+
- [regexhq](https://github.com/orgs/regexhq/repositories)
2832
- [sindresorhus](https://github.com/sindresorhus?tab=repositories&q=regex&type=&language=&sort=)
2933

3034
## Credits
@@ -39,6 +43,6 @@ LATER
3943
[![npm](https://www.vectorlogo.zone/logos/npmjs/npmjs-ar21.svg)](https://www.npmjs.com/ "JS Package Management")
4044
[![Phosphor Icons](https://www.vectorlogo.zone/logos/phosphoricons/phosphoricons-ar21.svg)](https://phosphoricons.com/ "Toolbar icons")
4145
[![react.js](https://www.vectorlogo.zone/logos/reactjs/reactjs-ar21.svg)](https://reactjs.org/ "UI Framework")
42-
[![Remix](https://www.vectorlogo.zone/logos/remix/remix-ar21.svg)](https://remix.run/ "React Framework")
46+
[![Remix](https://www.vectorlogo.zone/logos/remixrun/remixrun-ar21.svg)](https://remix.run/ "React Framework")
4347
[![TypeScript](https://www.vectorlogo.zone/logos/typescriptlang/typescriptlang-ar21.svg)](https://www.typescriptlang.org/ "Programming Language")
4448
[![Vite](https://www.vectorlogo.zone/logos/vitejsdev/vitejsdev-ar21.svg)](https://vitejs.dev/ "Bundler")

TODO.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# To Do
22

3-
- [ ] /library/
4-
- [ ] /library/xxx/
5-
- [ ] nodeping
6-
- [ ] /tag/
7-
- [ ] /tag/xxx/
3+
- [ ] sitemap.xml
4+
- [ ] search.html
5+
- [ ] copy to clipboard for variations
6+
- [ ] test button for variations
87
- [ ] comments via utteranc.es
98
- [ ] homepage: search
109
- [ ] homepage: featured
1110
- [ ] homepage: latest
12-
- [ ] sitemap.xml
11+
- [ ] notes for variations
12+
- [ ] tags for variations
1313
- [ ] post to RegexPlanet
1414
- [ ] JSON schema for library
1515
- [ ] CI for yaml validated via json schema
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
'use client';
22

3-
import { Button, Group, useMantineColorScheme } from '@mantine/core';
3+
import { Button, ButtonGroup } from 'react-bootstrap';
4+
5+
function setColorScheme(scheme: 'light' | 'dark' | 'auto') {
6+
if (scheme == 'auto') {
7+
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
8+
scheme = 'dark';
9+
} else {
10+
scheme = 'light';
11+
}
12+
}
13+
document.documentElement.setAttribute('data-bs-theme', scheme);
14+
}
415

516
export function ColorSchemeToggle() {
6-
const { setColorScheme } = useMantineColorScheme();
717

818
return (
9-
<Group justify="center" mt="xl">
19+
<ButtonGroup>
1020
<Button onClick={() => setColorScheme('light')}>Light</Button>
1121
<Button onClick={() => setColorScheme('dark')}>Dark</Button>
1222
<Button onClick={() => setColorScheme('auto')}>Auto</Button>
13-
</Group>
23+
</ButtonGroup>
1424
);
1525
}

app/components/Footer.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
const links = [
3+
{ link: 'https://github.com/regexplanet/regex-zone/issues', label: 'Feedback' },
4+
{ link: 'https://github.com/regexplanet/regex-zone?tab=readme-ov-file#credits', label: 'Credits'},
5+
{ link: 'https://github.com/regexplanet/regex-zone', label: 'Source' },
6+
{ link: 'https://github.com/regexplanet/regex-zone?tab=readme-ov-file#other-libraries-of-regex-patterns', label: 'Alternatives' },
7+
];
8+
9+
export function Footer() {
10+
11+
const initial:JSX.Element[] = []
12+
links.forEach((link, index) => {
13+
initial.push(<a className="text-body-tertiary text-decoration-none" href={link.link} key={link.label}>
14+
{link.label}
15+
</a>);
16+
if (index < links.length - 1) {
17+
initial.push(<span className="mx-1">|</span>);
18+
}
19+
}
20+
);
21+
22+
return (
23+
<footer className="d-flex justify-content-center text-body-tertiary pt-3"><small>
24+
{ initial }
25+
</small></footer>
26+
)
27+
}

app/components/HeaderSearch/HeaderSearch.module.css

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,45 @@
1-
import { Autocomplete, Group, Burger, rem, Anchor } from '@mantine/core';
2-
import { useDisclosure } from '@mantine/hooks';
31
import { PiMagnifyingGlass } from 'react-icons/pi';
4-
import { Link as RemixLink } from "@remix-run/react";
2+
import { Link as RemixLink, useLocation } from "@remix-run/react";
3+
import { Container, Navbar } from 'react-bootstrap';
54

6-
import classes from './HeaderSearch.module.css';
75
import RegexZoneSvg from '../Logos/RegexZoneSvg';
86

97
const links = [
108
{ link: '/library/', label: 'Library' },
11-
{ link: '/docs/', label: 'Docs' },
9+
//{ link: '/docs/', label: 'Docs' },
1210
{ link: 'https://www.regexplanet.com/', label: 'Testing' },
13-
{ link: 'https://github.com/regexplanet/regex-zone/discussions', label: 'Community' },
11+
//{ link: 'https://github.com/regexplanet/regex-zone/discussions', label: 'Community' },
12+
{ link: '/search.html', label: 'Search' },
13+
{ link: '/404', label: '404' },
1414
];
1515

1616
export function HeaderSearch() {
17-
const [opened, { toggle }] = useDisclosure(false);
17+
const { pathname } = useLocation();
1818

1919
const items = links.map((link) => (
20+
<li className="nav-item" key = {link.label} >
2021
<RemixLink
21-
key={link.label}
22+
className={pathname.startsWith(link.link) ? 'nav-link active fw-bold' : 'nav-link'}
2223
to={link.link}
23-
className={classes.link}
2424
>
2525
{link.label}
2626
</RemixLink>
27+
</li>
2728
));
2829

2930
return (
30-
<header className={classes.header}>
31-
<div className={classes.inner}>
32-
<Group>
33-
<Burger opened={opened} onClick={toggle} size="sm" hiddenFrom="sm" />
34-
<RegexZoneSvg style={{ width: rem(32), height: rem(32) }} />
35-
<Anchor
36-
className={classes.sitename}
37-
href="/"
38-
visibleFrom="md"
39-
>Regex Zone</Anchor>
40-
</Group>
41-
42-
<Group>
43-
<Group ml={50} gap={5} className={classes.links} visibleFrom="sm">
44-
{items}
45-
</Group>
46-
<Autocomplete
47-
className={classes.search}
48-
placeholder="Search"
49-
leftSection={<PiMagnifyingGlass style={{ width: rem(16), height: rem(16) }} />}
50-
data={['React', 'Angular', 'Vue', 'Next.js', 'Riot.js', 'Svelte', 'Blitz.js']}
51-
/>
52-
</Group>
53-
</div>
54-
</header>
31+
<>
32+
<Navbar className="bg-body-tertiary border-bottom">
33+
<Container>
34+
<Navbar.Brand as={RemixLink} className="fw-bold" to="/">
35+
<RegexZoneSvg height={'2rem'} className="pe-2" />
36+
Regex Zone
37+
</Navbar.Brand>
38+
<ul className="navbar-nav">
39+
{items}
40+
</ul>
41+
</Container>
42+
</Navbar>
43+
</>
5544
);
5645
}

app/components/Library.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,33 @@ const LIBRARY_DIR = path.join(process.cwd(), "library");
66

77
export type LibraryEntry = {
88
title: string;
9+
detail?: string; // markdown!
910
handle: string;
1011
fullPath: string;
12+
tags?: string[];
13+
variations: LibraryEntryVariation[];
14+
};
15+
16+
export type LibraryEntryVariation = {
17+
title: string;
18+
pattern: string;
19+
description?: string;
1120
};
1221

1322
const cache: Map<string, LibraryEntry> = new Map();
1423
const all: LibraryEntry[] = [];
1524

1625
async function initialize() {
17-
const fileNames = await fsPromises.readdir(LIBRARY_DIR);
26+
if (all.length > 0) {
27+
return;
28+
}
29+
const fileNames = await fsPromises.readdir(LIBRARY_DIR);
1830
for await (const fileName of fileNames) {
1931
const fullPath = path.join(LIBRARY_DIR, fileName);
2032
console.log(`filename=${fullPath}`);
2133

2234
const raw = await fsPromises.readFile(fullPath, "utf-8");
2335
const parsed = yaml.load(raw, {
24-
fullPath,
2536
schema: yaml.JSON_SCHEMA,
2637
}) as LibraryEntry;
2738
parsed.fullPath = fullPath;
@@ -33,21 +44,17 @@ async function initialize() {
3344
}
3445

3546
function get(handle: string) {
36-
3747
const entry = cache.get(handle);
3848

3949
if (!entry) {
40-
throw new Error(`Unknown catalog entry ${handle}`);
50+
return null;
4151
}
4252

4353
return entry;
4454
}
4555

4656
function getAll(): LibraryEntry[] {
47-
4857
return all;
4958
}
5059

51-
initialize();
52-
5360
export { get, getAll, initialize };

app/components/TagList.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Link as RemixLink } from "@remix-run/react";
2+
3+
export function TagList(tags: string[]) {
4+
return (
5+
<>
6+
{tags.map((tag) => (
7+
<RemixLink
8+
key={tag}
9+
to={`/library/tags.html?tag=${tag}`}
10+
className="badge text-bg-primary text-decoration-none me-2"
11+
>
12+
{tag.replace('-', ' ')}
13+
</RemixLink>
14+
))}
15+
</>
16+
);
17+
}

app/components/Welcome/Welcome.module.css

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

0 commit comments

Comments
 (0)