-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f2aae2
commit 5c6dcde
Showing
90 changed files
with
208 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
import { useContext } from "react"; | ||
import { LgContext, LContext } from "../lg-context.js"; | ||
import { l } from "./l.module.css"; | ||
|
||
const Br = ({index}) => { | ||
const count = useContext(LgContext); | ||
const theIndex = useContext(LContext); | ||
index ??= theIndex; | ||
const last = index + 1 >= count; | ||
return last ? null : <br />; | ||
}; | ||
|
||
// FIXME rm last break | ||
export const L = ({ children }) => | ||
export const L = ({ children, index }) => | ||
<> | ||
<span role="presentation" className={l}>{children}</span> | ||
<br /> | ||
<span role="presentation" className={l}> | ||
{children} | ||
</span> | ||
<Br index={index} /> | ||
</>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { createContext } from 'react'; | ||
|
||
export const LgContext = createContext(0); | ||
LgContext.displayName = 'Lg'; | ||
|
||
export const LContext = createContext(0); | ||
LContext.displayName = 'L'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,19 @@ | ||
import { withClass } from "@features/util"; | ||
import { Children } from 'react'; | ||
import { LgContext, LContext } from "../lg-context.js"; | ||
import { lg } from "./lg.module.css"; | ||
|
||
export const Lg = withClass('p', lg); | ||
const LgProvider = LgContext.Provider; | ||
const LProvider = LContext.Provider; | ||
|
||
export const Lg = ({ | ||
children, | ||
count = Children.count(children) | ||
}) => | ||
<p className={lg}> | ||
<LgProvider value={count}> | ||
{Children.map(children, (child, ix) => <LProvider value={ix}> | ||
{child} | ||
</LProvider> | ||
)} | ||
</LgProvider> | ||
</p>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.