Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ import { P, divider } from './component/elements.jsx'
import { Router } from './lib/router.js'
import { Profile } from './page/profile.jsx'
import { Home } from './page/home.jsx'
import { Exercise } from './page/exercise.jsx'

const App = () => (
<>
<Header />
<Router>
<Profile path="/profile" />
<Home path="*" />
<Exercise path="/exercise" />
</Router>
<footer>
{divider}
Expand Down
2 changes: 1 addition & 1 deletion component/header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const LinkMatch = ({ match, children, path, ...props }) => (
const clearStorage = () => localStorage.clear()

// prettier-ignore
const NavLink = (props) => <li> - <Link {...props} /></li>
export const NavLink = (props) => <li> - <Link {...props} /></li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pas sur que je trouve ca specialement intressant d'exporter ca plutot que de le copier / coller dans ce cas

const LogAction = () => {
if (!user) {
return (
Expand Down
70 changes: 70 additions & 0 deletions component/markdown.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { Span, Color, P, Div } from './elements.jsx'
import { css } from '../lib/dom.js'
import { NavLink } from '../component/header.jsx'
import { NavLink } from './header.jsx'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import { NavLink } from '../component/header.jsx'
import { NavLink } from './header.jsx'

?? ce code compile ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

faut eviter autan que possible de lier les components entre eux, le headers doit pas creer des components generique reutiliser par markdown.jsx


css(`
li.mli {
display:block;
}

.warn{
outline:1px dashed red;
padding:0.8rem;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

padding en rem ca va pas gerer que l'allignement reste sur la grille de characters monospace (mode text quoi)

}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je pense qu'il faut eviter les noms de class css trop generique si elle ne sont pas scoper dans une classe parente plus specifique.


`)

export const MTitle = Object.fromEntries(
['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].map((el) => [
el,
({ children, ...props }) =>
h(
el,
props,
<>
<Span fg="red">{'#'.repeat(Number(el.slice(1)))}</Span>&nbsp;
</>,
children,
),
]),
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tu peu pre-compute une partie du code:

export const MTitle = Object.fromEntries(
  ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].map((el) => {
    const decoration = <Span fg="red">{'#'.repeat(Number(el.slice(1)))}</Span>
    return [el, ({ children, ...props }) => h(el, props, decoration, children)]
  }),
)

Mais je pense que c'est encore mieu de le generer en css directement, comme c'est fait ici: https://github.com/egoist/hack/blob/master/src/css/markdown.css#L91-L105


export const MItalicWord = ({ children, color, type }) => {
return (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless return, I do think a lot of this could be achieve with a class and :before :after elements too

<P>
<Color.Orange>{'>'}</Color.Orange>
<Color.CommentLighter>*</Color.CommentLighter>
<Span fg={color} style={{ fontStyle: 'italic' }}>
{children}
</Span>
<Color.CommentLighter>*</Color.CommentLighter>
{type === 'ps' && <Color.Orange>{'<'}</Color.Orange>}
</P>
)
}

export const MLi = ({ children, link }) => {
let ColorIze = link ? Color.CyanDarker : Color.CommentLighter
return (
<NavLink class={`mli`} href={link ? link : null}>
<Span fg="orange"> - </Span>
<Span
style={{
padding: '0.1rem',
background: !link && 'rgba(75, 75, 75, 0.63)',
textDecoration: link && 'underline',
}}
fg={link ? 'cyan-darker' : 'white'}
>
<ColorIze>{link ? '[' : '`'}</ColorIze>
{children}
<ColorIze>{link ? ']' : '`'}</ColorIze>
</Span>
</NavLink>
)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je suis pas convaincu de ce MLi, tu devrais le decouper en 3 components:

  • Les LI
  • Les Liens
  • Le text

et eviter un truc aussi specifique


export const Warning = ({ children }) => {
return <Div class="warn">{children}</Div>
}
6 changes: 0 additions & 6 deletions data/fakeExercise.json

This file was deleted.

134 changes: 0 additions & 134 deletions page/exercise.jsx

This file was deleted.