Add rotating logo for the intro
This commit is contained in:
61
stories/intro/KeycloakifyRotatingLogo.tsx
Normal file
61
stories/intro/KeycloakifyRotatingLogo.tsx
Normal file
@ -0,0 +1,61 @@
|
||||
import React from "react";
|
||||
import { memo, useState } from "react";
|
||||
import { useConstCallback } from "powerhooks";
|
||||
import { keyframes } from "tss-react";
|
||||
import keycloakifyLogoHeroMovingPngUrl from "./keycloakify-logo-hero-moving.png";
|
||||
import keycloakifyLogoHeroStillPngUrl from "./keycloakify-logo-hero-still.png";
|
||||
import { makeStyles } from "./tss";
|
||||
|
||||
export type Props = {
|
||||
style?: React.CSSProperties;
|
||||
id?: string;
|
||||
onLoad?: () => void;
|
||||
};
|
||||
|
||||
export const KeycloakifyRotatingLogo = memo((props: Props) => {
|
||||
const { id, style, onLoad: onLoadProp } = props;
|
||||
|
||||
const [isImageLoaded, setIsImageLoaded] = useState(false);
|
||||
|
||||
const onLoad = useConstCallback(() => {
|
||||
setIsImageLoaded(true);
|
||||
onLoadProp?.();
|
||||
});
|
||||
|
||||
const { classes, cx } = useStyles({
|
||||
isImageLoaded
|
||||
});
|
||||
return (
|
||||
<div id={id} className={classes.root} style={style}>
|
||||
<img className={classes.rotatingImg} onLoad={onLoad} src={keycloakifyLogoHeroMovingPngUrl} alt={"Rotating react logo"} />
|
||||
<img className={classes.stillImg} src={keycloakifyLogoHeroStillPngUrl} alt={"keyhole"} />
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
const useStyles = makeStyles<{ isImageLoaded: boolean }>({
|
||||
"name": { KeycloakifyRotatingLogo }
|
||||
})((_theme, { isImageLoaded }) => ({
|
||||
"root": {
|
||||
"position": "relative"
|
||||
},
|
||||
"rotatingImg": {
|
||||
"animation": `${keyframes({
|
||||
"from": {
|
||||
"transform": "rotate(0deg)"
|
||||
},
|
||||
"to": {
|
||||
"transform": "rotate(360deg)"
|
||||
}
|
||||
})} infinite 20s linear`,
|
||||
"width": isImageLoaded ? "100%" : undefined,
|
||||
"height": isImageLoaded ? "auto" : undefined
|
||||
},
|
||||
"stillImg": {
|
||||
"position": "absolute",
|
||||
"top": "0",
|
||||
"left": "0",
|
||||
"width": isImageLoaded ? "100%" : undefined,
|
||||
"height": isImageLoaded ? "auto" : undefined
|
||||
}
|
||||
}));
|
4
stories/intro/global.d.ts
vendored
Normal file
4
stories/intro/global.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
declare module "*.png" {
|
||||
const _default: string;
|
||||
export default _default;
|
||||
}
|
35
stories/intro/intro.stories.mdx
Normal file
35
stories/intro/intro.stories.mdx
Normal file
@ -0,0 +1,35 @@
|
||||
import { Meta } from "@storybook/addon-docs";
|
||||
import { KeycloakifyRotatingLogo } from "./KeycloakifyRotatingLogo";
|
||||
|
||||
<Meta
|
||||
title="Introduction"
|
||||
parameters={{
|
||||
"viewMode": "docs",
|
||||
"previewTabs": {
|
||||
"canvas": { "hidden": true },
|
||||
"zoom": { "hidden": true },
|
||||
"storybook/background": { "hidden": true },
|
||||
"storybook/viewport": { "hidden": true },
|
||||
},
|
||||
}}
|
||||
/>
|
||||
|
||||
<div style={{ "margin": "0 auto", "maxWidth": "700px", "textAlign": "center" }}>
|
||||
<div style={{ "display": "flex", "justifyContent": "center" }}>
|
||||
<KeycloakifyRotatingLogo style={{ "width": 400 }} />
|
||||
</div>
|
||||
<h1><a href="#">Keycloakify </a> Storybook</h1>
|
||||
|
||||
<p>
|
||||
This website showcases all the Keycloak user-facing pages that can be customized using Keycloakify.
|
||||
The storybook serves as a comprehensive reference to help you determine which pages you would like to personalize.
|
||||
Keep in mind that customizing the <a href="https://github.com/keycloakify/keycloakify-starter/blob/main/src/keycloak-theme/login/Template.tsx"><code>Template</code></a> component alone will already cover 90% of your customization needs.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you discover that a page you wish to customize is not currently supported by Keycloakify, don't worry.
|
||||
Simply refer to <a href="https://docs.keycloakify.dev/limitations#i-have-established-that-a-page-that-i-need-isnt-supported-out-of-the-box-by-keycloakify-now-what">this documentation page</a> for further assistance.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
BIN
stories/intro/keycloakify-logo-hero-moving.png
Normal file
BIN
stories/intro/keycloakify-logo-hero-moving.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 95 KiB |
BIN
stories/intro/keycloakify-logo-hero-still.png
Normal file
BIN
stories/intro/keycloakify-logo-hero-still.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.9 KiB |
5
stories/intro/tss.ts
Normal file
5
stories/intro/tss.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { createMakeAndWithStyles } from "tss-react";
|
||||
|
||||
export const { makeStyles, useStyles } = createMakeAndWithStyles({
|
||||
"useTheme": () => ({})
|
||||
});
|
Reference in New Issue
Block a user