Skip to content

Commit

Permalink
Merge branch 'main' into add-email-support
Browse files Browse the repository at this point in the history
  • Loading branch information
JeevaRamu0104 authored Jan 17, 2025
2 parents a8344f9 + 5073b70 commit 4b92d62
Show file tree
Hide file tree
Showing 12 changed files with 172 additions and 87 deletions.
38 changes: 22 additions & 16 deletions public/hyperswitch/icons/solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions public/hyperswitch/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ function appendStyle(themesConfig) {
let cssVariables = `:root{
/* Colors */
${generateVariablesForSection(settings.colors, "colors")}
/* sidebar */
${generateVariablesForSection(settings.sidebar, "sidebar")}
/* Typography */
${generateVariablesForSection(settings.typography, "base")}
/* Buttons */
Expand Down
15 changes: 12 additions & 3 deletions src/UIConifg/UIConfig.res
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,13 @@ module BorderConfig = {
}

module SidebarConfig = {
type backgroundColor = {sidebarNormal: string}
type t = {backgroundColor: backgroundColor}
type backgroundColor = {sidebarNormal: string, sidebarSecondary: string}
type t = {
backgroundColor: backgroundColor,
primaryTextColor: string,
secondaryTextColor: string,
hoverColor: string,
}
}

type t = {
Expand Down Expand Up @@ -174,7 +179,11 @@ let defaultUIConfig: t = {
secondaryColor: "bg-secondary",
sidebarColor: {
backgroundColor: {
sidebarNormal: "bg-sidebar",
sidebarNormal: "bg-sidebar-primary",
sidebarSecondary: "bg-sidebar-secondary md:bg-sidebar-secondary ",
},
primaryTextColor: "text-sidebar-primaryTextColor",
secondaryTextColor: "text-sidebar-secondaryTextColor/80",
hoverColor: "hover:bg-sidebar-hoverColor/10",
},
}
28 changes: 25 additions & 3 deletions src/context/ThemeProvider.res
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ let newDefaultConfig: HyperSwitchConfigTypes.customStylesTheme = {
colors: {
primary: "#006DF9",
secondary: "#303E5F",
sidebar: "#242F48",
background: "#006df9",
},
sidebar: {
primary: "#242F48",
secondary: "#303E5F",
hoverColor: "#ffffff",
primaryTextColor: "#ffffff",
secondaryTextColor: "#ffffff",
},
typography: {
fontFamily: "Roboto, sans-serif",
fontSize: "14px",
Expand Down Expand Up @@ -116,6 +122,7 @@ let make = (~children) => {
let settings = dict->getDictfromDict("settings")
let url = dict->getDictfromDict("urls")
let colorsConfig = settings->getDictfromDict("colors")
let sidebarConfig = settings->getDictfromDict("sidebar")
let typography = settings->getDictfromDict("typography")
let borders = settings->getDictfromDict("borders")
let spacing = settings->getDictfromDict("spacing")
Expand All @@ -127,9 +134,24 @@ let make = (~children) => {
colors: {
primary: colorsConfig->getString("primary", defaultSettings.colors.primary),
secondary: colorsConfig->getString("secondary", defaultSettings.colors.secondary),
sidebar: colorsConfig->getString("sidebar", defaultSettings.colors.sidebar),
background: colorsConfig->getString("background", defaultSettings.colors.background),
},
sidebar: {
// This 'colorsConfig' will be replaced with 'sidebarConfig', and the 'sidebar' key will be changed to 'primary' after API Changes.
primary: colorsConfig->getString("sidebar", defaultSettings.sidebar.primary),
// This 'colorsConfig' will be replaced with 'sidebarConfig' once the API changes are done.
secondary: colorsConfig->getString("secondary", defaultSettings.sidebar.secondary),
hoverColor: sidebarConfig->getString("hoverColor", defaultSettings.sidebar.hoverColor),
// This property is currently required to support current sidebar changes. It will be removed in a future update.
primaryTextColor: sidebarConfig->getString(
"primaryTextColor",
defaultSettings.sidebar.primaryTextColor,
),
secondaryTextColor: sidebarConfig->getString(
"secondaryTextColor",
defaultSettings.sidebar.secondaryTextColor,
),
},
typography: {
fontFamily: typography->getString("fontFamily", defaultSettings.typography.fontFamily),
fontSize: typography->getString("fontSize", defaultSettings.typography.fontSize),
Expand Down Expand Up @@ -238,7 +260,7 @@ let make = (~children) => {
"settings": {
"colors": {
"primary": dict->getString("primary_color", defaultSettings.colors.primary),
"sidebar": dict->getString("sidebar_color", defaultSettings.colors.sidebar),
"sidebar": dict->getString("sidebar_color", defaultSettings.sidebar.primary),
},
"buttons": {
"primary": {
Expand Down
14 changes: 10 additions & 4 deletions src/entryPoints/configs/HyperSwitchConfigTypes.res
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@ type urlConfig = {
urlThemeConfig: urlThemeConfig,
}

// themes struct type

// Type definition for themes
type colorPalette = {
primary: string,
secondary: string,
sidebar: string,
background: string,
}

type typographyConfig = {
fontFamily: string,
fontSize: string,
Expand Down Expand Up @@ -53,8 +50,17 @@ type buttonConfig = {
secondary: buttonStyleConfig,
}

type sidebarConfig = {
primary: string,
secondary: string,
hoverColor: string,
primaryTextColor: string,
secondaryTextColor: string,
}

type themeSettings = {
colors: colorPalette,
sidebar: sidebarConfig,
typography: typographyConfig,
buttons: buttonConfig,
borders: borderConfig,
Expand Down
6 changes: 5 additions & 1 deletion src/entryPoints/configs/HyperSwitchDefaultConfig.res
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ let config: UIConfig.t = {
},
sidebarColor: {
backgroundColor: {
sidebarNormal: "bg-sidebar",
sidebarNormal: "bg-sidebar-primary",
sidebarSecondary: "bg-sidebar-secondary",
},
primaryTextColor: "text-sidebar-primaryTextColor",
secondaryTextColor: "text-sidebar-secondaryTextColor",
hoverColor: "hover:bg-sidebar-hoverColor",
},
}
5 changes: 3 additions & 2 deletions src/screens/Helpers/PageLoaderWrapper.res
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ module ScreenLoader = {
let loaderLottieFile = LottieFiles.useLottieJson("hyperswitch_loader.json")
let loader = LottieFiles.useLottieJson("loader-circle.json")
let {devThemeFeature} = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom
let {userInfo: {themeId}} = React.useContext(UserInfoProvider.defaultContext)
let {branding} = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom

let showLoader = devThemeFeature && themeId->LogicUtils.isNonEmptyString
<div className={`${sectionHeight} w-scrren flex flex-col justify-center items-center`}>
<RenderIf condition={!branding}>
<div className="w-20 h-16">
<ReactSuspenseWrapper>
<div className="scale-400 pt-px">
<Lottie
animationData={devThemeFeature ? loader : loaderLottieFile} autoplay=true loop=true
animationData={showLoader ? loader : loaderLottieFile} autoplay=true loop=true
/>
</div>
</ReactSuspenseWrapper>
Expand Down
13 changes: 8 additions & 5 deletions src/screens/OMPSwitch/OMPSwitchHelper.res
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,24 @@ module ListBaseComp = {
~isDarkBg=false,
~showDropdownArrow=true,
) => {
let {globalUIConfig: {sidebarColor: {secondaryTextColor}}} = React.useContext(
ThemeProvider.themeContext,
)
let baseCompStyle = isDarkBg
? "text-white hover:bg-opacity-80 bg-sidebar-blue"
: "text-black hover:bg-opacity-80"

let iconName = isDarkBg ? "arrow-without-tail-new" : "arrow-without-tail"

let arrowDownClass = isDarkBg
? "rotate-0 transition duration-[250ms] opacity-70"
: "rotate-180 transition duration-[250ms] opacity-70"
? `rotate-0 transition duration-[250ms] opacity-70 ${secondaryTextColor}`
: `rotate-180 transition duration-[250ms] opacity-70 `

let arrowUpClass = isDarkBg
? "-rotate-180 transition duration-[250ms] opacity-70"
: "rotate-0 transition duration-[250ms] opacity-70"
? `-rotate-180 transition duration-[250ms] opacity-70 ${secondaryTextColor}`
: `rotate-0 transition duration-[250ms] opacity-70 `

let textColor = isDarkBg ? "text-grey-300" : "text-grey-900"
let textColor = isDarkBg ? `${secondaryTextColor}` : "text-grey-900"
let width = isDarkBg ? "w-[12rem]" : "min-w-[5rem] w-fit max-w-[10rem]"
let paddingSubheading = isDarkBg ? "pl-2" : ""
let paddingHeading = isDarkBg ? "pl-2" : ""
Expand Down
Loading

0 comments on commit 4b92d62

Please sign in to comment.