Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 0 additions & 3 deletions .browserslistrc

This file was deleted.

1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ module.exports = {
"react/jsx-curly-brace-presence": "warn",
// jsx-ally
"jsx-a11y/no-onchange": WARN,
"import/no-anonymous-default-export": OFF,
},
}
15 changes: 0 additions & 15 deletions .lighthouserc.js

This file was deleted.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"@mdx-js/react": "^2.3.0",
"@next/mdx": "^13.4.4",
"@types/node": "^20.2.5",
"class-variance-authority": "^0.6.0",
"clsx": "^1.2.1",
"little-state-machine": "^4.8.0",
"next": "^13.4.4",
Expand All @@ -18,12 +19,10 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-github-btn": "1.4.0",
"react-helmet": "6.1.0",
"react-hook-form": "6.0.0",
"react-simple-animate": "^3.5.2",
"react-simple-img": "3.0.0",
"react-sortablejs": "1.5.1",
"react-syntax-highlighter": "^15.5.0",
"rehype-mdx-code-props": "^1.0.0",
"remark-custom-heading-id": "^1.0.1",
"remark-emoji": "^3.1.1",
Expand Down
58 changes: 58 additions & 0 deletions src/components/Admonition.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
.admonition {
margin-bottom: 1em;
padding: 15px 30px 15px 15px;
border-radius: 0.4rem;
}

.admonitionIcon {
display: inline-block;
vertical-align: middle;
margin-right: 0.2em;
}

.admonitionIcon svg {
display: inline-block;
width: 22px;
height: 22px;
stroke-width: 0;
}

.admonitionIcon svg {
stroke: rgb(253, 253, 254);
fill: rgb(253, 253, 254);
}

.admonitionContent > :last-child {
margin-bottom: 0;
}

/** Customization */
.admonitionWarning {
background-color: rgba(230, 126, 34, 0.1);
border-left: 8px solid #e67e22;
}

.admonitionTip {
background-color: rgba(46, 204, 113, 0.1);
border-left: 8px solid #2ecc71;
}

.admonitionCaution {
background-color: rgba(231, 76, 60, 0.1);
border-left: 8px solid #e74c3c;
}

.admonitionImportant {
background-color: rgb(25, 60, 71, 0.1);
border-left: 8px solid rgb(76, 179, 212, 0.1);
}

.admonitionNote {
background-color: rgb(71, 71, 72, 0.1);
border-left: 8px solid rgb(212, 213, 216);
}

.admonitionQuestion {
background-color: rgba(8, 61, 119, 0.1);
border-left: 8px solid #083d77;
}
113 changes: 113 additions & 0 deletions src/components/Admonition.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import styles from "./Admonition.module.css"
import { cva } from "class-variance-authority"

/**
* Octicons Icons by GitHub released under MIT License
* https://github.com/primer/octicons/
*/

const svgMap = {
warning: (
<svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
viewBox="0 0 16 16"
>
<path
fillRule="evenodd"
d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"
/>
</svg>
),
important: (
<svg
xmlns="http://www.w3.org/2000/svg"
width="14"
height="16"
viewBox="0 0 14 16"
>
<path
fillRule="evenodd"
d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"
/>
</svg>
),
caution: (
<svg
xmlns="http://www.w3.org/2000/svg"
width="12"
height="16"
viewBox="0 0 12 16"
>
<path
fillRule="evenodd"
d="M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"
/>
</svg>
),
tip: (
<svg
xmlns="http://www.w3.org/2000/svg"
width="12"
height="16"
viewBox="0 0 12 16"
>
<path
fillRule="evenodd"
d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"
/>
</svg>
),
note: (
<svg
xmlns="http://www.w3.org/2000/svg"
width="14"
height="16"
viewBox="0 0 14 16"
>
<path
fillRule="evenodd"
d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"
/>
</svg>
),
question: (
<svg
xmlns="http://www.w3.org/2000/svg"
width="14"
height="16"
viewBox="0 0 14 16"
>
<path
fill-rule="evenodd"
d="M6 10h2v2H6v-2zm4-3.5C10 8.64 8 9 8 9H6c0-.55.45-1 1-1h.5c.28 0 .5-.22.5-.5v-1c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5V7H4c0-1.5 1.5-3 3-3s3 1 3 2.5zM7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7s7-3.14 7-7s-3.14-7-7-7z"
/>
</svg>
),
}

const admonition = cva(styles.admonition, {
Copy link
Member

@bluebill1049 bluebill1049 Jun 15, 2023

Choose a reason for hiding this comment

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

switch to img tag instead of inline svg?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe I did it this way because there is SOME styling applied to the SVGs. Can that be done with inline img?

Copy link
Member

Choose a reason for hiding this comment

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

no worries, img is normally better than inline svg, with better perf, and better cache, but don't worry about it. Large PR I will continue my review.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again, I'm sorry for the large PR's :(

Copy link
Member

Choose a reason for hiding this comment

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

Not at all, thanks for soring everything out and making a huge improvement on the site.

variants: {
type: {
warning: styles.admonitionWarning,
important: styles.admonitionImportant,
caution: styles.admonitionCaution,
tip: styles.admonitionTip,
note: styles.admonitionNote,
question: styles.admonitionQuestion,
},
},
})

export const Admonition = ({ type, title, children }) => {
return (
<div className={admonition({ type })}>
<div className={styles.admonitionHeading}>
<span className={styles.admonitionIcon}>{svgMap[type]}</span>{" "}
<b>{title?.toUpperCase() || type.toUpperCase()}</b>
</div>
<div className={styles.admonitionContent}>{children}</div>
</div>
)
}
51 changes: 2 additions & 49 deletions src/components/AdvancedPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,7 @@ import StarRepo from "./StarRepo"
import typographyStyles from "../styles/typography.module.css"
import containerStyles from "../styles/container.module.css"
import AdvancedContent, { meta } from "../content/advanced.mdx"
import NewSideMenu from "./NewSideMenu"

const links = [
{
title: "Accessibility (A11y)",
href: "#AccessibilityA11y",
},
{
title: "Wizard Form / Funnel",
href: "#WizardFormFunnel",
},
{
title: "Smart Form Component",
href: "#SmartFormComponent",
},
{
title: "Error Messages",
href: "#ErrorMessages",
},
{
title: "Connect Form",
href: "#ConnectForm",
},
{
title: "FormProvider Performance",
href: "#FormProviderPerformance",
},
{
title: "Controlled mixed with Uncontrolled Components",
href: "#ControlledmixedwithUncontrolledComponents",
},
{
title: "Custom Hook with Resolver",
href: "#CustomHookwithResolver",
},
{
title: "Working with virtualized lists",
href: "#Workingwithvirtualizedlists",
},
{
title: "Testing Form",
href: "#TestingForm",
},
{
title: "Transform and Parse",
href: "#TransformandParse",
},
]
import { Menu, advancedLinks } from "./Menu"

function Advanced() {
return (
Expand All @@ -61,7 +14,7 @@ function Advanced() {
<p className={typographyStyles.subHeading}>{meta.description}</p>

<div className={containerStyles.wrapper}>
<NewSideMenu links={links} />
<Menu pages={advancedLinks} />

<main>
<AdvancedContent />
Expand Down
113 changes: 0 additions & 113 deletions src/components/ApiErrors.tsx

This file was deleted.

Loading