-
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.
docs: Applications from popular libraries (#1)
* docs: added 8 zod applications * feat: conjunction * feat: applications in CodeExample * feat: add githubStars * docs: todo for intrinsic types * docs: added 2 react-router applications * docs: applications todo * docs: added 5 rxjs applications * docs: added 2 jest applications * docs: added array to object application from ts-pattern * refactor: move Projects to a separate React component * refactor: make applications required * docs: added 5 prisma, 3 typeorm, 1 redux, 1 trpc & 1 ts-pattern applications * docs: tick a feature * docs: added 2 typeorm applications * docs: intro update * docs: add 3 safe-units applications * docs: added 1 prisma application * docs: added 1 zod application * docs: added 1 prisma & 2 type-fest applications * refactor: update conjunction * feat: added breadcrumbs for zod applications * feat: added breadcrumbs for prisma applications * feat: added breadcrumbs for rxjs applications * feat: added breadcrumbs to ts-pattern applications * feat: added breadcrumbs for jest applications * feat: added breadcrumbs to typeorm applications * feat: added breadcrumbs to dot-path-value applications * feat: added breadcrumbs to @reduxjs/toolkit applications * feat: added breadcrumbs to 2 type-fest & 2 react-router applications * feat: added breadcrumbs to 3 trpc applications * feat: added breadcrumbs to safe-units applications
- Loading branch information
Showing
6 changed files
with
981 additions
and
11 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
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
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,69 @@ | ||
import { useContext } from "react"; | ||
import { map } from "../utils/map"; | ||
import { UserInputContext } from "../contexts/UserInputContext"; | ||
import { Link } from "./Link"; | ||
import { conjunction } from "../utils/conjunction"; | ||
// import { ArrowIcon } from "./icons/ArrowIcon"; | ||
|
||
export const Projects = () => { | ||
const { source, target } = useContext(UserInputContext); | ||
|
||
if (!source || !target || map[source][target] === "empty") { | ||
return null; | ||
} | ||
|
||
return ( | ||
<> | ||
{map[source][target].applications.length > 0 && ( | ||
<div> | ||
<h3>Projects</h3> | ||
<span>Links to the libraries that already use this conversion:</span> | ||
<ol> | ||
{map[source][target].applications.map((application, i) => ( | ||
<li key={i}> | ||
{application.library && ( | ||
<span> | ||
{application.library} | ||
{": "} | ||
</span> | ||
)} | ||
<span> | ||
{application.breadcrumbs && | ||
application.breadcrumbs.map( | ||
(breadcrumb, j, breadcrumbs) => ( | ||
<> | ||
<Link | ||
href={breadcrumb.href} | ||
external | ||
text={breadcrumb.text} | ||
/> | ||
|
||
{conjunction(j, breadcrumbs, { | ||
last: "", | ||
secondToLast: ( | ||
<> | ||
{" "} | ||
{/* <ArrowIcon /> */} | ||
{">"}{" "} | ||
</> | ||
), | ||
others: ( | ||
<> | ||
{" "} | ||
{/* <ArrowIcon /> */} | ||
{">"}{" "} | ||
</> | ||
), | ||
})} | ||
</> | ||
) | ||
)} | ||
</span> | ||
</li> | ||
))} | ||
</ol> | ||
</div> | ||
)} | ||
</> | ||
); | ||
}; |
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
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,21 @@ | ||
type ConjunctionOptions = { | ||
last: JSX.Element | string; | ||
secondToLast: JSX.Element | string; | ||
others: JSX.Element | string; | ||
}; | ||
|
||
export const conjunction = <T>( | ||
index: number, | ||
array: T[], | ||
options: ConjunctionOptions | ||
): JSX.Element | string => { | ||
if (index === array.length - 2) { | ||
return options.secondToLast; | ||
} | ||
|
||
if (index === array.length - 1) { | ||
return options.last; | ||
} | ||
|
||
return options.others; | ||
}; |
Oops, something went wrong.