From 092b849ae4bd7024b953800af67d4f18b95eb2bc Mon Sep 17 00:00:00 2001 From: Tan Nhu Date: Sat, 13 Apr 2024 20:09:54 +0000 Subject: [PATCH] Fix UICore CSS import ordering problem by dynamically import app.css (#1208) --- web/package.json | 6 ++--- web/src/App.scss | 17 +++++++++++++ web/src/App.tsx | 1 + web/src/bootstrap.scss | 3 +-- .../timePopoverLocal/TimePopoverWithLocal.tsx | 20 +++++++++------- web/yarn.lock | 24 +++++++++---------- 6 files changed, 46 insertions(+), 25 deletions(-) create mode 100644 web/src/App.scss diff --git a/web/package.json b/web/package.json index 80c3b7d43..31d686123 100644 --- a/web/package.json +++ b/web/package.json @@ -43,9 +43,9 @@ "@codemirror/language-data": "^6.3.0", "@codemirror/state": "^6.2.0", "@codemirror/view": "^6.9.6", - "@harnessio/design-system": "^1.6.0-beta.1", - "@harnessio/icons": "^2.0.0-beta.2", - "@harnessio/uicore": "^4.0.0-beta.1a", + "@harnessio/design-system": "^2.1.1", + "@harnessio/icons": "^2.1.0", + "@harnessio/uicore": "^4.1.0", "@types/dompurify": "^3.0.2", "@types/react-monaco-editor": "^0.16.0", "@uiw/codemirror-extensions-color": "^4.19.9", diff --git a/web/src/App.scss b/web/src/App.scss new file mode 100644 index 000000000..847e0e052 --- /dev/null +++ b/web/src/App.scss @@ -0,0 +1,17 @@ +/* + * Copyright 2023 Harness, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@import '~@harnessio/design-system/dist/style.css'; +@import '~@harnessio/uicore/dist/index.css'; diff --git a/web/src/App.tsx b/web/src/App.tsx index cd43ea660..effac21cb 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -33,6 +33,7 @@ import type { LanguageRecord } from './framework/strings/languageLoader' import { StringsContextProvider } from './framework/strings/StringsContextProvider' import 'highlight.js/styles/github.css' import 'diff2html/bundles/css/diff2html.min.css' +import './App.scss' import css from './App.module.scss' FocusStyleManager.onlyShowFocusOnTabs() diff --git a/web/src/bootstrap.scss b/web/src/bootstrap.scss index b78f803b1..07b43dbba 100644 --- a/web/src/bootstrap.scss +++ b/web/src/bootstrap.scss @@ -18,11 +18,10 @@ NOTE: This file is loaded only in standalone mode. In embedded mode, the shared styles are loaded by Harness Platform already. */ + @import '~normalize.css'; @import '~@blueprintjs/core/lib/css/blueprint.css'; @import '~@blueprintjs/datetime/lib/css/blueprint-datetime.css'; -@import '~@harnessio/design-system/dist/style.css'; -@import '~@harnessio/uicore/dist/index.css'; html, body, diff --git a/web/src/utils/timePopoverLocal/TimePopoverWithLocal.tsx b/web/src/utils/timePopoverLocal/TimePopoverWithLocal.tsx index 713847e1a..889e2c9be 100644 --- a/web/src/utils/timePopoverLocal/TimePopoverWithLocal.tsx +++ b/web/src/utils/timePopoverLocal/TimePopoverWithLocal.tsx @@ -15,14 +15,18 @@ import moment from 'moment' import { useStrings } from 'framework/strings' import css from './TimePopoverWithLocal.module.scss' -export type TimePopoverProps = TextProps & - Omit & { - date?: ReactTimeagoProps['date'] - time: number - popoverProps?: IPopoverProps - icon?: IconName - className?: string - } +type ReactTimeagoPropsWithoutDate = Omit +type CommonTextProps = Omit +type CommonReactTimeagoProps = Omit + +interface TimePopoverProps extends CommonTextProps, CommonReactTimeagoProps { + date?: ReactTimeagoProps['date'] + popoverProps?: IPopoverProps + icon?: IconName + className?: string + title?: string | undefined + time: number +} export const DATE_TIME_PARSE_FORMAT = 'MMM DD, YYYY hh:mm:ss A' export const DATE_PARSE_FORMAT = 'MMM DD, YYYY' diff --git a/web/yarn.lock b/web/yarn.lock index 65c1c2942..082e10e2d 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -1630,20 +1630,20 @@ resolved "https://registry.yarnpkg.com/@exodus/schemasafe/-/schemasafe-1.0.0.tgz#f44e252665b1a6bdef0d686e22af3599a6f0a095" integrity sha512-2cyupPIZI69HQxEAPllLXBjQp4njDKkOjYRCYxvMZe3/LY9pp9fBM3Tb1wiFAdP6Emo4v3OEbCLGj6u73Q5KLw== -"@harnessio/design-system@^1.6.0-beta.1": - version "1.6.0-beta.1" - resolved "https://registry.npmjs.org/@harnessio/design-system/-/design-system-1.6.0-beta.1.tgz#9a0c45607ba3e7f32b61db87d44533a204d1fbaf" - integrity sha512-JOsVgj1ecqqWQL/j+WULSxO3GxcrLdBE00cKUUdhLnGjBQ29bO6o1JRLKyJMKfVitgiUVnK9QtqD+4WWfBQHdg== +"@harnessio/design-system@^2.1.1": + version "2.1.1" + resolved "https://registry.npmjs.org/@harnessio/design-system/-/design-system-2.1.1.tgz#2da3036602ed9b9446d8139c72009e6dc1e25642" + integrity sha512-ZwAGM1srOZ49/6YkwyjkczUv4v91CN0rCecRYnV3/g+xdSV5ycrUvkJjl9nHub6jw2eCGC0GdyNgAtAJnLmGfQ== -"@harnessio/icons@^2.0.0-beta.2": - version "2.0.0-beta.2" - resolved "https://registry.npmjs.org/@harnessio/icons/-/icons-2.0.0-beta.2.tgz#82c9602e44d3eccadc8b393ba58c4714aa829846" - integrity sha512-SAA/gDHdb8gNx2LnGgdFwcmJJETyYL2b7DzUSQL3HRZ9Ha3zfhfwAdpErFETpfF5maxfr2rHr8WbDPF69RchlQ== +"@harnessio/icons@^2.1.0": + version "2.1.0" + resolved "https://registry.npmjs.org/@harnessio/icons/-/icons-2.1.0.tgz#9d93d5a4080e76d4f1b435ca2d28266d0ba936d0" + integrity sha512-9DFu0v+Q0nx2HeJb7lWaWA6lnokSPcAKnjBDi87BWaY6SXbCn8Tk5wqWSnv/V2Xmn05iN89hjnuAjOhTuSpxXA== -"@harnessio/uicore@^4.0.0-beta.1a": - version "4.0.0-beta.1a" - resolved "https://registry.npmjs.org/@harnessio/uicore/-/uicore-4.0.0-beta.1a.tgz#530d9b859795f2d4048c20c63fa97b6d244a5211" - integrity sha512-243zY+ClWj7/LSvbd+7f1qWOP/OALr6KgH7uqNoeVSHIAqNN/8pX9wkovH4AMnH3CPfcb+VTP4mGOMNSh5m1Vg== +"@harnessio/uicore@^4.1.0": + version "4.1.0" + resolved "https://registry.npmjs.org/@harnessio/uicore/-/uicore-4.1.0.tgz#e7b18ce59ddbde07441b9a5da8250b0cdd35f91e" + integrity sha512-NUJt5ZD3PP55QR9mLhvRCn2uUhy18uY+Lv9z5J37Hoc+e5DVtnp6FG/ZNvqPpSXnnvQ3bFGElf8AD4bJmIs9Hg== "@humanwhocodes/config-array@^0.5.0": version "0.5.0"