mirror of
https://github.com/rive-app/rive-react.git
synced 2026-03-13 08:22:30 +08:00
Storybookk page reloads when the package in the parent changes
This commit is contained in:
32
examples/src/components/RiveThing.tsx
Normal file
32
examples/src/components/RiveThing.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import React from 'react';
|
||||
import { useRive } from '@rive-app/react-canvas';
|
||||
|
||||
type User = {
|
||||
name: string;
|
||||
};
|
||||
|
||||
export interface HeaderProps {
|
||||
user?: User;
|
||||
onLogin?: () => void;
|
||||
onLogout?: () => void;
|
||||
onCreateAccount?: () => void;
|
||||
}
|
||||
|
||||
export const RiveThing = ({
|
||||
user,
|
||||
onLogin,
|
||||
onLogout,
|
||||
onCreateAccount,
|
||||
}: HeaderProps) => {
|
||||
const { RiveComponent } = useRive({
|
||||
src: 'https://cdn.rive.app/animations/vehicles.riv',
|
||||
stateMachines: 'bumpy',
|
||||
autoplay: true,
|
||||
});
|
||||
|
||||
return (
|
||||
<header className="header">
|
||||
<RiveComponent />
|
||||
</header>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user