-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom Keycloak theme with required login (#164)
- Loading branch information
1 parent
f95852c
commit e12cf93
Showing
55 changed files
with
23,119 additions
and
2,393 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:react-hooks/recommended", | ||
"plugin:storybook/recommended" | ||
], | ||
ignorePatterns: ["dist", ".eslintrc.cjs"], | ||
parser: "@typescript-eslint/parser", | ||
plugins: ["react-refresh"], | ||
rules: { | ||
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }], | ||
"react-hooks/exhaustive-deps": "off", | ||
"@typescript-eslint/no-redeclare": "off", | ||
"no-labels": "off" | ||
}, | ||
overrides: [ | ||
{ | ||
files: ["**/*.stories.*"], | ||
rules: { | ||
"import/no-anonymous-default-export": "off" | ||
} | ||
} | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# yarn cache directory | ||
.pnp.* | ||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions | ||
|
||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
.vscode | ||
|
||
.DS_Store | ||
|
||
/dist | ||
|
||
/build | ||
/storybook-static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules/ | ||
/dist/ | ||
/dist_keycloak/ | ||
/public/keycloakify-dev-resources/ | ||
/.vscode/ | ||
/.yarn_home/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"printWidth": 90, | ||
"tabWidth": 4, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": false, | ||
"trailingComma": "none", | ||
"bracketSpacing": true, | ||
"arrowParens": "avoid", | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"**/login/pages/*.tsx", | ||
"**/account/pages/*.tsx", | ||
"**/login/Template.tsx", | ||
"**/account/Template.tsx", | ||
"**/login/UserProfileFormFields.tsx", | ||
"KcApp.tsx" | ||
], | ||
"options": { | ||
"printWidth": 150 | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { StorybookConfig } from "@storybook/react-vite"; | ||
|
||
const config: StorybookConfig = { | ||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], | ||
addons: [], | ||
framework: { | ||
name: "@storybook/react-vite", | ||
options: {} | ||
}, | ||
staticDirs: ["../public"] | ||
}; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<style> | ||
body.sb-show-main.sb-main-padded { | ||
padding: 0; | ||
} | ||
|
||
/* Following styles are just meant to avoid white flash when switching from one story to another */ | ||
@keyframes fadeToTransparent { | ||
from { | ||
background-color: #393939; | ||
} | ||
|
||
to { | ||
background-color: transparent; | ||
} | ||
} | ||
html { | ||
animation: fadeToTransparent 500ms forwards ease-in; | ||
} | ||
body > .sb-preparing-docs { | ||
visibility: hidden; | ||
} | ||
body > .sb-preparing-story { | ||
visibility: hidden; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { Preview } from "@storybook/react"; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i | ||
} | ||
} | ||
} | ||
}; | ||
|
||
export default preview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 GitHub user u/garronej | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<p align="center"> | ||
<i>🚀 <a href="https://keycloakify.dev">Keycloakify</a> v11 starter 🚀</i> | ||
<br/> | ||
<br/> | ||
</p> | ||
|
||
This starter is based on Vite. There is also [a Webpack based starter](https://github.com/keycloakify/keycloakify-starter-webpack). | ||
|
||
# Quick start | ||
|
||
```bash | ||
git clone https://github.com/keycloakify/keycloakify-starter | ||
cd keycloakify-starter | ||
yarn install # Or use an other package manager, just be sure to delete the yarn.lock if you use another package manager. | ||
``` | ||
|
||
# Testing the theme locally | ||
|
||
[Documentation](https://docs.keycloakify.dev/v/v10/testing-your-theme) | ||
|
||
# How to customize the theme | ||
|
||
[Documentation](https://docs.keycloakify.dev/v/v10/customization-strategies) | ||
|
||
# Building the theme | ||
|
||
You need to have [Maven](https://maven.apache.org/) installed to build the theme (Maven >= 3.1.1, Java >= 7). | ||
The `mvn` command must be in the $PATH. | ||
|
||
- On macOS: `brew install maven` | ||
- On Debian/Ubuntu: `sudo apt-get install maven` | ||
- On Windows: `choco install openjdk` and `choco install maven` (Or download from [here](https://maven.apache.org/download.cgi)) | ||
|
||
```bash | ||
npm run build-keycloak-theme | ||
``` | ||
|
||
Note that by default Keycloakify generates multiple .jar files for different versions of Keycloak. | ||
You can customize this behavior, see documentation [here](https://docs.keycloakify.dev/targeting-specific-keycloak-versions). | ||
|
||
# Initializing the account theme | ||
|
||
```bash | ||
npx keycloakify initialize-account-theme | ||
``` | ||
|
||
# Initializing the email theme | ||
|
||
```bash | ||
npx keycloakify initialize-email-theme | ||
``` | ||
|
||
# GitHub Actions | ||
|
||
The starter comes with a generic GitHub Actions workflow that builds the theme and publishes | ||
the jars [as GitHub releases artifacts](https://github.com/keycloakify/keycloakify-starter/releases/tag/v10.0.0). | ||
To release a new version **just update the `package.json` version and push**. | ||
|
||
To enable the workflow go to your fork of this repository on GitHub then navigate to: | ||
`Settings` > `Actions` > `Workflow permissions`, select `Read and write permissions`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"$schema": "https://ui.shadcn.com/schema.json", | ||
"style": "new-york", | ||
"rsc": false, | ||
"tsx": true, | ||
"tailwind": { | ||
"config": "tailwind.config.js", | ||
"css": "src/login/index.css", | ||
"baseColor": "neutral", | ||
"cssVariables": true, | ||
"prefix": "" | ||
}, | ||
"aliases": { | ||
"components": "@/components", | ||
"utils": "@/lib/utils", | ||
"ui": "@/components/ui", | ||
"lib": "@/lib", | ||
"hooks": "@/hooks" | ||
}, | ||
"iconLibrary": "lucide" | ||
} |
Binary file not shown.
Binary file added
BIN
+1.74 MB
keycloakify/dist_keycloak/keycloak-theme-for-kc-all-other-versions.jar
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="theme-color" content="default-color" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
|
||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" /> | ||
</head> | ||
|
||
<script> | ||
// JavaScript should be placed inside <script> tags and not as FreeMarker expressions | ||
const theme = localStorage.getItem("theme"); | ||
const browserDark = window.matchMedia("(prefers-color-scheme: dark)").matches; | ||
if (theme !== null) { | ||
if (theme === "dark") { | ||
document.documentElement.classList.add("dark"); | ||
} | ||
document.documentElement.setAttribute("data-color-mode", theme); | ||
} else { | ||
if (browserDark) { | ||
document.documentElement.classList.add("dark"); | ||
} | ||
document.documentElement.setAttribute( | ||
"data-color-mode", | ||
browserDark ? "dark" : "light" | ||
); | ||
localStorage.setItem("theme", browserDark ? "dark" : "light"); | ||
} | ||
|
||
const metaThemeColor = document.querySelector('meta[name="theme-color"]'); | ||
if (metaThemeColor) { | ||
metaThemeColor.setAttribute( | ||
"content", | ||
"hsl(" + | ||
getComputedStyle(document.documentElement).getPropertyValue( | ||
"--background" | ||
) + | ||
")" | ||
); | ||
} | ||
</script> | ||
|
||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.