Skip to content

Commit

Permalink
Merge pull request #6 from charlie-tango/feat/upgrade-vitest-2
Browse files Browse the repository at this point in the history
Add `htmlAttributes` to UmbracoRichText and upgrade to Vitest 2
  • Loading branch information
thebuilder committed Jul 15, 2024
2 parents 3ae6d3a + 7325ca5 commit bc825ed
Show file tree
Hide file tree
Showing 17 changed files with 1,939 additions and 8,800 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
run: pnpm install
- name: Lint
run: pnpm biome ci .
- name: Install playwright
run: pnpx playwright install chromium
- name: Test
run: pnpm test
env:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ lib-cov
logs
node_modules
temp
__screenshots__
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ npm install @charlietango/react-umbraco

### `<UmbracoRichText>`

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)](https://stackblitz.com/github/charlie-tango/react-umbraco/tree/main/examples/UmbracoRichText?file=src/RichText.tsx)
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)](https://stackblitz.com/github/charlie-tango/react-umbraco/tree/main?file=examples/UmbracoRichText/src/RichText.tsx)

Takes the rich text property from the Umbraco Content Delivery API and renders
it with React.
Expand All @@ -28,6 +28,10 @@ it with React.
- `renderBlock`: Render a specific block type.
- `renderNode`: Overwrite the default rendering of a node. Return `undefined` to
render the default node. Return `null` to skip rendering the node.
- `htmlAttributes`: Default attributes to set on the defined HTML elements.
These will be used, unless the element already has the attribute set. The only
exception is the `className` attribute, which will be merged with the default
value.

When passing the `renderBlock` and `renderNode` props, consider making them
static functions (move them outside the consuming component) to avoid
Expand Down Expand Up @@ -74,6 +78,7 @@ function RichText({ data }) {
element={data.richText}
renderNode={renderNode}
renderBlock={renderBlock}
htmlAttributes={{ p: "mb-4" }}
/>
);
}
Expand Down
18 changes: 0 additions & 18 deletions examples/UmbracoRichText/.eslintrc.cjs

This file was deleted.

File renamed without changes.
39 changes: 0 additions & 39 deletions examples/UmbracoRichText/README.md

This file was deleted.

Loading

0 comments on commit bc825ed

Please sign in to comment.