Skip to content

Commit

Permalink
use prettier to format markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
thebuilder committed May 5, 2024
1 parent b99685e commit 5c36535
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 34 deletions.
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/*.*
!**/*.md
58 changes: 27 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,31 @@ Takes the rich text property from the Umbraco Content Delivery API and renders i

```tsx
import { UmbracoRichText } from "@charlietango/react-umbraco";
import Image from 'next/image'
import Link from 'next/link'
import Image from "next/image";
import Link from "next/link";

const MyComponent = ({ data }) => {
return (
<UmbracoRichText
element={data.richText}
renderNode={({ tag, children, attributes }) => {
switch (tag) {
case "a":
return <Link {...attributes}>{children}</Link>;
default:
return undefined;
}
}}
renderBlock={({ content }) => {
switch (content?.contentType) {
case "imageBlock":
return <Image {...content.properties} />;
default:
return null;
}
}}
/>
);
return (
<UmbracoRichText
element={data.richText}
renderNode={({ tag, children, attributes }) => {
switch (tag) {
case "a":
return <Link {...attributes}>{children}</Link>;
default:
return undefined;
}
}}
renderBlock={({ content }) => {
switch (content?.contentType) {
case "imageBlock":
return <Image {...content.properties} />;
default:
return null;
}
}}
/>
);
};
```

Expand All @@ -65,23 +65,19 @@ for `ApiBlockItemModel`.
**types/react-umbraco.d.ts**

```ts
import {components} from '@/openapi/umbraco';
import { components } from "@/openapi/umbraco";

// Define the intermediate interface
type ApiBlockItemModel = components['schemas']['ApiBlockItemModel'];
type ApiBlockItemModel = components["schemas"]["ApiBlockItemModel"];

declare module '@charlietango/react-umbraco' {
interface UmbracoBlockItemModel extends ApiBlockItemModel {
}
declare module "@charlietango/react-umbraco" {
interface UmbracoBlockItemModel extends ApiBlockItemModel {}
}
```

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/@charlietango/react-umbraco?style=flat&colorA=080f12&colorB=1fa669

[npm-version-href]: https://npmjs.com/package/@charlietango/react-umbraco

[license-src]: https://img.shields.io/github/license/charlie-tango/react-umbraco.svg?style=flat&colorA=080f12&colorB=1fa669

[license-href]: https://github.com/charlie-tango/react-umbraco/blob/main/LICENSE
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"url": "git+https://github.com/charlietango/react-umbraco.git"
},
"bugs": "https://github.com/charlietango/react-umbraco/issues",
"keywords": [],
"keywords": ["umbraco", "react", "content delivery api", "headless cms"],
"sideEffects": false,
"exports": {
".": {
Expand Down Expand Up @@ -56,7 +56,7 @@
"bumpp": "^9.4.1",
"happy-dom": "^14.7.1",
"lint-staged": "^15.2.2",
"pnpm": "^9.0.6",
"prettier": "^3.2.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rimraf": "^5.0.5",
Expand All @@ -72,6 +72,7 @@
"lint-staged": {
"*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [
"biome check --apply --no-errors-on-unmatched"
]
],
"*.md": ["prettier --write"]
}
}
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5c36535

Please sign in to comment.