-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ability to customize border radius in ui demo (#785)
* feat: add ability to customize border radius in ui demo * fix: remove indent * fix: remove unused variables * fix: export shared functions * fix: move whitespace
- Loading branch information
1 parent
ca517f1
commit 2ce7d2d
Showing
7 changed files
with
49 additions
and
35 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 |
---|---|---|
@@ -1,27 +1,30 @@ | ||
import type { AccountKitTheme, ComponentDef } from "../types"; | ||
import { getBorderRadiusBaseVariableName } from "../utils.js"; | ||
|
||
export const borderRadiusVariables = (theme: AccountKitTheme): ComponentDef => { | ||
const { borderRadius } = theme; | ||
const borderRadiusValue = (() => { | ||
switch (borderRadius) { | ||
case "lg": | ||
return "24px"; | ||
case "md": | ||
return "16px"; | ||
case "xs": | ||
return "4px"; | ||
case "none": | ||
return "0px"; | ||
case "sm": | ||
default: | ||
return "8px"; | ||
} | ||
})(); | ||
export function getBorderRadiusValue( | ||
borderRadius: AccountKitTheme["borderRadius"] | ||
): string { | ||
switch (borderRadius) { | ||
case "lg": | ||
return "24px"; | ||
case "md": | ||
return "16px"; | ||
case "xs": | ||
return "4px"; | ||
case "none": | ||
return "0px"; | ||
case "sm": | ||
default: | ||
return "8px"; | ||
} | ||
} | ||
|
||
export function borderRadiusVariables(theme: AccountKitTheme): ComponentDef { | ||
return { | ||
":root": { | ||
[getBorderRadiusBaseVariableName()]: borderRadiusValue, | ||
[getBorderRadiusBaseVariableName()]: getBorderRadiusValue( | ||
theme.borderRadius | ||
), | ||
}, | ||
}; | ||
}; | ||
} |
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import { accountKitUi } from "./plugin.js"; | ||
export { getAccountKitContentPath, withAccountKitUi } from "./plugin.js"; | ||
export type * from "./types.js"; | ||
export { createColorSet, getColorVariableName } from "./utils.js"; | ||
export { | ||
createColorSet, | ||
getColorVariableName, | ||
getBorderRadiusBaseVariableName, | ||
} from "./utils.js"; | ||
export { getBorderRadiusValue } from "./components/border-vars.js"; | ||
|
||
export default accountKitUi; |
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
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
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
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
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