Skip to content

Commit

Permalink
fix(Example): no default font url (#1440)
Browse files Browse the repository at this point in the history
  • Loading branch information
abernier committed May 11, 2023
1 parent a5e16eb commit d22dd4a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
4 changes: 1 addition & 3 deletions .storybook/stories/Example.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ export const ExampleSt = ({ fontUrl, color, bevelSize, debug }) => {
apiRef.current?.incr()
}
}}
>
<Sparkles scale={2} />
</Example>
/>
</>
)
}
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1892,15 +1892,15 @@ function Scene() {
A "counter" example.

```tsx
<Example />
<Example font="/Inter_Bold.json" />
```

```tsx
type ExampleProps = {
font: string
color?: Color
debug?: boolean
bevelSize?: number
font?: string
}
```

Expand All @@ -1909,7 +1909,7 @@ Ref-api:
```tsx
const api = useRef<ExampleApi>()
<Example ref={api} />
<Example ref={api} font="/Inter_Bold.json" />
```

```tsx
Expand Down
7 changes: 2 additions & 5 deletions src/core/Example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { Text3D } from './Text3D'
import { Center } from './Center'

export type ExampleProps = {
font: string
color?: Color
debug?: boolean
bevelSize?: number
font?: string
} & JSX.IntrinsicElements['group']

export type ExampleApi = {
Expand All @@ -19,10 +19,7 @@ export type ExampleApi = {
}

export const Example = React.forwardRef<ExampleApi, ExampleProps>(
(
{ font = '/fonts/Inter_Bold.json', color = '#cbcbcb', bevelSize = 0.04, debug = false, children, ...props },
fref
) => {
({ font, color = '#cbcbcb', bevelSize = 0.04, debug = false, children, ...props }, fref) => {
const [counter, setCounter] = React.useState(0)

const incr = React.useCallback((x = 1) => setCounter(counter + x), [counter])
Expand Down

1 comment on commit d22dd4a

@vercel
Copy link

@vercel vercel bot commented on d22dd4a May 11, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.