Skip to content

Commit

Permalink
Merge pull request #361 from Ajay-aot/feature/FWF-3992-custom-theme
Browse files Browse the repository at this point in the history
Feature/fwf 3992 custom theme changes
  • Loading branch information
arun-s-aot authored Dec 9, 2024
2 parents c695726 + 292fd9c commit 33d4f22
Show file tree
Hide file tree
Showing 18 changed files with 175 additions and 143 deletions.
2 changes: 1 addition & 1 deletion forms-flow-components/src/components/SvgIcons/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const computedStyle = getComputedStyle(document.documentElement);
const baseColor = computedStyle.getPropertyValue("--ff-base-600");
const baseColor = computedStyle.getPropertyValue("--ff-primary");
const grayColor = computedStyle.getPropertyValue("--ff-gray-800");
export const ChevronIcon = ({
color = baseColor,
Expand Down
43 changes: 32 additions & 11 deletions forms-flow-nav/src/root.component.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,46 @@
import NavBar from "./Navbar";
import { BrowserRouter as Router } from "react-router-dom";
import Sidebar from "./sidenav/Sidebar";
import React, { useState } from "react";
import React, { useRef, useEffect, useState } from "react";
import "./Navbar.scss";
import HamburgerMenu from "./sidenav/hamburgerMenu";
import { StyleServices } from "@formsflow/service";

export default function Root(props) {
const [tenantLogo, setTenantLogo] = React.useState("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACoCAMAAABt9SM9AAAAeFBMVEX///8BAQH8/Pz5+fnIyMjExMTn5+f19fXW1tbw8PChoaGxsbHX19fq6uqVlZWamprPz8/d3d2qqqpsbGyOjo69vb1nZ2d3d3cvLy8lJSVjY2M3NzdUVFSFhYV+fn48PDxERERMTEwoKCgeHh4MDAwWFhZDQ0NaWlpI396UAAAE9UlEQVR4nO3dDWKiMBAF4I0iCigiora12rqt7f1vuCtqa5SfJMyEoO87QJIGEoc82P3zBwAAAAAAAAAAAAAAAAAAAAAAAAAAwEyv7QF0yKDtAXRI6Lc9An5jor9xsaVpx1l+uEqHNE2NBE07bhouVuLdo2rNFylVU87xsichNhOy9gJxpzfWeLoTQjxH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b8Tr4WpciBUNqNwmEWL8UtldpbvLM4vlflZ3bOcCZUNTer/RCIuhcqmLE2VU6GyMfP3DzQ4GWoZaJgYK3A01DJx86UAsZXbh+p6Rpwz9elwqGWEb6ruaP2d1b3pYMrZULkJlrLU5pfKVu3Ip8rpULkZ6i3e8VC5IaVPkBW5Hyo3NCSbqu6EWuYWNFOVdSFUbo4gPOzkobqZpq/rdfRQ3VCTN4f2YccP9bTtjG+qB9jUbxi9vfce3WmlXietnxvZU/gYP3+FJjuNmXp7hP+Mp9Kg/l+oyi2jzr2nwMGrLSJ204cqE6oFt//e9dnHPHXjy1uX9JLpXP6sbr3MotGdRDQs+v448bxkPAsetDwAAAAAAAAAAAAAAAAAAAAAAAAAAAD4B/UcPRFXugBuAAAAAElFTkSuQmCC");
const [tenantName, setTenantName] = React.useState("nike");
const customLogoPath = StyleServices?.getCSSVariable("--custom-logo-path");
const customTitle = StyleServices?.getCSSVariable("--custom-title");
const headerRef = useRef(null);
const sidenavRef = useRef(null);
const [sidenavHeight, setSidenavHeight] = useState("100%");
const hasMultitenancyHeader = customLogoPath || customTitle;
useEffect(() => {
const headerHeight = headerRef.current?.offsetHeight || 0;
const totalHeight = `calc(100% - ${headerHeight}px)`;
setSidenavHeight(totalHeight);
}, [ hasMultitenancyHeader ]);

return (
<Router>
{/* <NavBar props={props} /> */}
<>
{/* <div className="multitenancy-header">
<img className="multitenancy-logo" src={tenantLogo} alt="custom logo" />
<span className="multitenancy-app-name">{tenantName}</span>
</div> */}
<HamburgerMenu props={props} />
<div className="main-sidenav">
<Sidebar props={props} />
</div>
{hasMultitenancyHeader && (
<div ref={headerRef} className="multitenancy-header">
{customLogoPath && (
<img
className="multitenancy-logo"
src={customLogoPath}
alt="custom logo"
/>
)}
{customTitle && (
<span className="multitenancy-app-name">{customTitle}</span>
)}
</div>
)}
<HamburgerMenu props={props} />
<div className="main-sidenav" ref={sidenavRef}>
<Sidebar props={props} sidenavHeight={sidenavHeight}/>
</div>
</>
</Router>
);
Expand Down
7 changes: 4 additions & 3 deletions forms-flow-nav/src/sidenav/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { ApplicationLogo } from "@formsflow/components";
import { ProfileSettingsModal } from "./ProfileSettingsModal";
import PropTypes from 'prop-types';

const Sidebar = React.memo(({ props }) => {
const Sidebar = React.memo(({ props, sidenavHeight }) => {
const [tenantLogo, setTenantLogo] = React.useState("");
const [tenantName, setTenantName] = React.useState("");
const [userDetail, setUserDetail] = React.useState({});
Expand Down Expand Up @@ -214,7 +214,7 @@ const Sidebar = React.memo(({ props }) => {
}

return (
<div className="sidenav">
<div className="sidenav" style={{ height: sidenavHeight }}>
<div className="logo-container">
{/* <img
className=""
Expand Down Expand Up @@ -391,7 +391,8 @@ const Sidebar = React.memo(({ props }) => {
Sidebar.propTypes = {
subscribe: PropTypes.func.isRequired,
getKcInstance: PropTypes.func.isRequired,
publish: PropTypes.func.isRequired
publish: PropTypes.func.isRequired,
sidenavHeight: PropTypes.func.isRequired,
};

export default Sidebar;
56 changes: 25 additions & 31 deletions forms-flow-nav/src/sidenav/Sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
position: fixed;
z-index: 1050;
left: 0;
background-color: var(--ff-white);
background-color: var(--navbar-bg-color);
display: flex;
flex-direction: column;
justify-content: space-between;
Expand All @@ -25,8 +25,8 @@
}

.accordion-button {
color: var(--ff-gray-800);
background-color: var(--ff-white);
color: var(--navbar-main-menu-active-font-color);
background-color: var(--navbar-bg-color);
gap: 0.5rem;

&:focus {
Expand All @@ -41,23 +41,23 @@
}

&:hover {
background-color: var(--ff-base-100);
background-color: var(--navbar-menu-hover-bg-color);
}

&:not(.collapsed) {
color: var(--ff-gray-800);
background-color: var(--ff-gray-100);
color: var(--navbar-main-menu-active-font-color);
background-color: var(--navbar-main-menu-active-bg-color);
}

}

.accordion-body {
color: var(--ff-gray-800);
color: var(--navbar-main-menu-active-font-color);
padding: 0;
}

.accordion-item {
background-color: var(--ff-white);
background-color: var(--navbar-bg-color);
border: none;
font-size: var(--font-size-sm);
font-weight: var(--font-size-sm);
Expand All @@ -75,21 +75,21 @@
display: block;
padding-block: var(--spacer-100);
padding-inline: var(--spacer-250) var(--spacer-100);
color: var(--ff-gray-800);
color: var(--navbar-main-menu-active-font-color);
text-decoration: none;
text-align: left;
width: 100%;
cursor: pointer;

&:hover {
text-decoration: none;
color: var(--ff-gray-800);
background-color: var(--ff-base-100);
color: var(--navbar-main-menu-active-font-color);
background-color: var(--navbar-menu-hover-bg-color);
}

&.active {
background-color: var(--ff-gray-800);
color: var(--ff-white);
background-color: var(--navbar-active-submenu-bg-color);
color: var(--navbar-active-submenu-font-color);
font-size: var(--font-size-sm);
font-weight: var(--font-weight-xl);
line-height: var(--text-line-height);
Expand All @@ -100,9 +100,9 @@
.user-container {
text-align: center;
border-top: 0.031rem solid var(--ff-gray-600);

color : var(--navbar-main-menu-active-font-color);
.username {
color: var(--ff-gray-800);
color: var(--navbar-main-menu-active-font-color);
padding: var(--spacer-100);
margin: 0;
text-align: left;
Expand All @@ -122,19 +122,18 @@
padding: var(--spacer-100) var(--spacer-150);
border: none;
cursor: pointer;
color: var(--ff-gray-800);
color: var(--navbar-main-menu-active-font-color);

&:hover {
background-color: var(--ff-base-100);
background-color: var(--navbar-menu-hover-bg-color);
}
}

.user-icon {
width: 2rem;
height: 2rem;
border-radius: 6.25rem;
background-color: var(--ff-gray-100);
color: var(--ff-gray-800);
background-color: var(--navbar-main-menu-active-bg-color);
display: flex;
align-items: center;
justify-content: center;
Expand All @@ -147,9 +146,9 @@
font-weight: var(--font-weight-sm);
line-height: var(--text-line-height);
letter-spacing: var(--text-space-xs);
background-color: var(--navbar-bg-color) !important;
margin: 0;
cursor: pointer;
background-color:var(--ff-white);
border: none;
margin-left: 0;
:hover{
Expand All @@ -160,7 +159,7 @@
.user-email {
overflow: hidden;
white-space: nowrap;
color: var(--ff-gray-800);
color: var(--navbar-main-menu-active-font-color);
text-overflow: ellipsis;
font-size: var(--font-size-xs);
font-weight: var(--font-weight-xs);
Expand All @@ -184,8 +183,8 @@
}

&.active .accordion-button {
background-color: var(--ff-gray-800);
color: var(--ff-white);
background-color: var(--navbar-active-submenu-bg-color);
color: var(--navbar-active-submenu-font-color);
}
}
}
Expand All @@ -201,7 +200,7 @@
.multitenancy-header {
height: var(--client-nav);
box-shadow: var(--shadow-lg);
background-color: var(--ff-white);
background-color: var(--navbar-bg-color);
display: flex;
align-items: center;
justify-content: center;
Expand All @@ -216,11 +215,11 @@
.multitenancy-app-name {
font-size: var(--font-size-md);
font-weight: var(--font-weight-lg);
color: var(--ff-gray-800);
color: var(--navbar-main-menu-active-font-color);
}

.active-header .accordion-button {
background-color: var(--ff-gray-100);
background-color: var(--navbar-main-menu-active-bg-color);
}


Expand All @@ -236,9 +235,4 @@
}
}

@media (min-width: 992px) {
.sidenav {
height: 100%;
}
}

2 changes: 1 addition & 1 deletion forms-flow-service/src/helpers/styleService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class StyleServices {
element: HTMLElement = document.documentElement
): string {
const value = getComputedStyle(element).getPropertyValue(variableName);
return value.trim();
return value === '" "' ? "" : value;
}
}

Expand Down
6 changes: 4 additions & 2 deletions forms-flow-theme/scss/_aiAssistant.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Variables for reused values
$secondary: var(--ff-secondary);
.ai-modal {
.modal-dialog {
margin-top: 2.5vh !important;
Expand Down Expand Up @@ -86,7 +88,7 @@
.ai-message-box {
margin-right: var(--spacer-200);
padding: var(--spacer-200);
background: var(--ff-base-100) !important;
background: $secondary !important;
border-radius: var(--radius-0100);
margin-top: var(--spacer-050);
}
Expand All @@ -102,7 +104,7 @@
.ai-response-loading {
border-radius: var(--radius-0100);
padding: var(--spacer-200);
background: var(--ff-base-100) !important;
background: $secondary !important;
max-width: 0.938rem;

.loading-dots {
Expand Down
Loading

0 comments on commit 33d4f22

Please sign in to comment.