Skip to content

Commit

Permalink
Pull request #263: background color fix with scroll issue fix
Browse files Browse the repository at this point in the history
Merge in EXC/orca-elements from achUIFix to master

* commit '5eb4dc56a15216c167b5b773bbfd29588f445908':
  background color fix with scroll issue fix
  • Loading branch information
arun.mishra authored and prafulkoppalkar committed Oct 10, 2023
2 parents cefbc7d + 5eb4dc5 commit 20cd7a7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Components/Modal.res
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ let make = (
<Loader showText=false />
</div>
<div
className="h-screen w-screen bg-black/40 flex m-auto items-center backdrop-blur-sm overflow-hidden"
className="h-screen w-screen bg-black/40 flex m-auto items-center backdrop-blur-sm overflow-scroll"
style={ReactDOMStyle.make(
~transition="opacity .35s ease .1s,background-color 600ms linear",
~opacity=!openModal ? "0" : "100",
Expand All @@ -58,7 +58,9 @@ let make = (
~transition="opacity .35s ease .1s,transform .35s ease .1s,-webkit-transform .35s ease .1s",
~opacity=!openModal ? "0" : "100",
~backgroundColor={
themeObj.colorBackground === "transparent" ? "" : themeObj.colorBackground
themeObj.colorBackground === "transparent"
? ""
: themeObj.colorBackground->Utils.rgbaTorgb
},
(),
)}>
Expand Down
21 changes: 21 additions & 0 deletions src/Utilities/Utils.res
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,27 @@ let getDictIsSome = (dict, key) => {
dict->Js.Dict.get(key)->Belt.Option.isSome
}

let rgbaTorgb = bgColor => {
let cleanBgColor = bgColor->Js.String2.trim
if cleanBgColor->Js.String2.startsWith("rgba") || cleanBgColor->Js.String2.startsWith("rgb") {
let start = cleanBgColor->Js.String2.indexOf("(")
let end = cleanBgColor->Js.String2.indexOf(")")

let colorArr =
cleanBgColor->Js.String2.substring(~from=start + 1, ~to_=end)->Js.String2.split(",")
if colorArr->Js.Array2.length === 3 {
cleanBgColor
} else {
let red = colorArr->Belt.Array.get(0)->Belt.Option.getWithDefault("0")
let green = colorArr->Belt.Array.get(1)->Belt.Option.getWithDefault("0")
let blue = colorArr->Belt.Array.get(2)->Belt.Option.getWithDefault("0")
`rgba(${red}, ${green}, ${blue})`
}
} else {
cleanBgColor
}
}

let delay = timeOut => {
Promise.make((resolve, _reject) => {
Js.Global.setTimeout(() => {
Expand Down

0 comments on commit 20cd7a7

Please sign in to comment.