From f57704b84421d48a4124cccbd3616309be613204 Mon Sep 17 00:00:00 2001 From: Tim Down <158919+timdown@users.noreply.github.com> Date: Mon, 4 Nov 2024 16:10:49 +0000 Subject: [PATCH] Merge pull request #21566 from overleaf/td-bs5-website-redesign Add website redesign query string override to arbitrary BS5 pages GitOrigin-RevId: 72816f00d6e2e92dab21035097abc540689af1d3 --- .../app/src/infrastructure/ExpressLocals.js | 5 +++++ services/web/app/views/layout-base.pug | 2 +- .../components/welcome-message.tsx | 6 +++--- .../js/features/settings/components/root.tsx | 6 +++--- .../canceled-subscription/canceled.tsx | 6 +++--- .../dashboard/subscription-dashboard.tsx | 6 +++--- .../components/group-invite/group-invite.tsx | 6 +++--- .../group-invites/group-invites-item.tsx | 6 +++--- .../successful-subscription.tsx | 6 +++--- .../{ol-card.tsx => ol-page-content-card.tsx} | 18 +++++++++--------- .../bootstrap-5/components/footer.scss | 3 ++- .../bootstrap-5/components/navbar.scss | 3 ++- .../bootstrap-5/pages/website-redesign.scss | 14 ++++++++++++-- 13 files changed, 52 insertions(+), 35 deletions(-) rename services/web/frontend/js/features/ui/components/ol/{ol-card.tsx => ol-page-content-card.tsx} (57%) diff --git a/services/web/app/src/infrastructure/ExpressLocals.js b/services/web/app/src/infrastructure/ExpressLocals.js index b81c3f5dc7..181cfb913b 100644 --- a/services/web/app/src/infrastructure/ExpressLocals.js +++ b/services/web/app/src/infrastructure/ExpressLocals.js @@ -373,6 +373,11 @@ module.exports = function (webRouter, privateApiRouter, publicApiRouter) { next() }) + webRouter.use(function (req, res, next) { + res.locals.websiteRedesignOverride = req.query.redesign === 'enabled' + next() + }) + webRouter.use(function (req, res, next) { res.locals.ExposedSettings = { isOverleaf: Settings.overleaf != null, diff --git a/services/web/app/views/layout-base.pug b/services/web/app/views/layout-base.pug index 493024b39c..a1a4dc0576 100644 --- a/services/web/app/views/layout-base.pug +++ b/services/web/app/views/layout-base.pug @@ -77,7 +77,7 @@ html( body(class={ 'thin-footer': showThinFooter, - 'website-redesign': isWebsiteRedesign === true + 'website-redesign': isWebsiteRedesign === true || websiteRedesignOverride }, data-theme="default") if(settings.recaptcha && settings.recaptcha.siteKeyV3) script(type="text/javascript", nonce=scriptNonce, src="https://www.recaptcha.net/recaptcha/api.js?render=" + settings.recaptcha.siteKeyV3, defer=deferScripts) diff --git a/services/web/frontend/js/features/project-list/components/welcome-message.tsx b/services/web/frontend/js/features/project-list/components/welcome-message.tsx index d85fbd4dc0..8cb5f80064 100644 --- a/services/web/frontend/js/features/project-list/components/welcome-message.tsx +++ b/services/web/frontend/js/features/project-list/components/welcome-message.tsx @@ -6,7 +6,7 @@ import type { Nullable } from '../../../../../types/utils' import WelcomeMessageLink from './welcome-message-new/welcome-message-link' import WelcomeMessageCreateNewProjectDropdown from './welcome-message-new/welcome-message-create-new-project-dropdown' import getMeta from '@/utils/meta' -import OLCard from '@/features/ui/components/ol/ol-card' +import OLPageContentCard from '@/features/ui/components/ol/ol-page-content-card' export default function WelcomeMessage() { const { t } = useTranslation() @@ -17,7 +17,7 @@ export default function WelcomeMessage() { return ( <> - +

{t('welcome_to_sl')}

@@ -43,7 +43,7 @@ export default function WelcomeMessage() {
-
+ setActiveModal(null)} diff --git a/services/web/frontend/js/features/settings/components/root.tsx b/services/web/frontend/js/features/settings/components/root.tsx index 275c355cc2..2198808056 100644 --- a/services/web/frontend/js/features/settings/components/root.tsx +++ b/services/web/frontend/js/features/settings/components/root.tsx @@ -21,7 +21,7 @@ import useScrollToIdOnLoad from '../../../shared/hooks/use-scroll-to-id-on-load' import { SSOAlert } from './emails/sso-alert' import OLRow from '@/features/ui/components/ol/ol-row' import OLCol from '@/features/ui/components/ol/ol-col' -import OLCard from '@/features/ui/components/ol/ol-card' +import OLPageContentCard from '@/features/ui/components/ol/ol-page-content-card' function SettingsPageRoot() { const { isReady } = useWaitForI18n() @@ -48,7 +48,7 @@ function SettingsPageContent() { return ( - +

{t('account_settings')}

@@ -92,7 +92,7 @@ function SettingsPageContent() { ) : null} -
+
) } diff --git a/services/web/frontend/js/features/subscription/components/canceled-subscription/canceled.tsx b/services/web/frontend/js/features/subscription/components/canceled-subscription/canceled.tsx index 10274ce09d..60551a4970 100644 --- a/services/web/frontend/js/features/subscription/components/canceled-subscription/canceled.tsx +++ b/services/web/frontend/js/features/subscription/components/canceled-subscription/canceled.tsx @@ -1,7 +1,7 @@ import { useTranslation } from 'react-i18next' import OLRow from '@/features/ui/components/ol/ol-row' import OLCol from '@/features/ui/components/ol/ol-col' -import OLCard from '@/features/ui/components/ol/ol-card' +import OLPageContentCard from '@/features/ui/components/ol/ol-page-content-card' import OLNotification from '@/features/ui/components/ol/ol-notification' function Canceled() { @@ -11,7 +11,7 @@ function Canceled() {
- +

{t('subscription_canceled')}

@@ -35,7 +35,7 @@ function Canceled() { < {t('back_to_your_projects')}

-
+
diff --git a/services/web/frontend/js/features/subscription/components/dashboard/subscription-dashboard.tsx b/services/web/frontend/js/features/subscription/components/dashboard/subscription-dashboard.tsx index afa5d0d7ea..6bb25065ea 100644 --- a/services/web/frontend/js/features/subscription/components/dashboard/subscription-dashboard.tsx +++ b/services/web/frontend/js/features/subscription/components/dashboard/subscription-dashboard.tsx @@ -10,7 +10,7 @@ import ManagedInstitutions from './managed-institutions' import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context' import getMeta from '../../../../utils/meta' import PremiumFeaturesLink from './premium-features-link' -import OLCard from '@/features/ui/components/ol/ol-card' +import OLPageContentCard from '@/features/ui/components/ol/ol-page-content-card' import OLRow from '@/features/ui/components/ol/ol-row' import OLCol from '@/features/ui/components/ol/ol-col' import OLNotification from '@/features/ui/components/ol/ol-notification' @@ -37,7 +37,7 @@ function SubscriptionDashboard() { type="warning" /> )} - +

{t('your_subscription')}

@@ -53,7 +53,7 @@ function SubscriptionDashboard() { {!hasDisplayedSubscription && (hasSubscription ? : )} -
+ diff --git a/services/web/frontend/js/features/subscription/components/group-invite/group-invite.tsx b/services/web/frontend/js/features/subscription/components/group-invite/group-invite.tsx index cc4bfe587f..a4e8fb2da8 100644 --- a/services/web/frontend/js/features/subscription/components/group-invite/group-invite.tsx +++ b/services/web/frontend/js/features/subscription/components/group-invite/group-invite.tsx @@ -9,7 +9,7 @@ import JoinGroup from './join-group' import AcceptedInvite from './accepted-invite' import OLRow from '@/features/ui/components/ol/ol-row' import OLCol from '@/features/ui/components/ol/ol-col' -import OLCard from '@/features/ui/components/ol/ol-card' +import OLPageContentCard from '@/features/ui/components/ol/ol-page-content-card' export type InviteViewTypes = | 'invite' @@ -74,7 +74,7 @@ export default function GroupInvite() { - +

-
+
diff --git a/services/web/frontend/js/features/subscription/components/group-invites/group-invites-item.tsx b/services/web/frontend/js/features/subscription/components/group-invites/group-invites-item.tsx index 50c64e7279..1c3bac35fe 100644 --- a/services/web/frontend/js/features/subscription/components/group-invites/group-invites-item.tsx +++ b/services/web/frontend/js/features/subscription/components/group-invites/group-invites-item.tsx @@ -1,7 +1,7 @@ import { Trans } from 'react-i18next' import GroupInvitesItemFooter from './group-invites-item-footer' import type { TeamInvite } from '../../../../../../types/team-invite' -import OLCard from '@/features/ui/components/ol/ol-card' +import OLPageContentCard from '@/features/ui/components/ol/ol-page-content-card' import OLRow from '@/features/ui/components/ol/ol-row' import OLCol from '@/features/ui/components/ol/ol-col' @@ -15,7 +15,7 @@ export default function GroupInvitesItem({ return ( - +

-
+
) diff --git a/services/web/frontend/js/features/subscription/components/successful-subscription/successful-subscription.tsx b/services/web/frontend/js/features/subscription/components/successful-subscription/successful-subscription.tsx index 9749cd91f2..ac85c4b90e 100644 --- a/services/web/frontend/js/features/subscription/components/successful-subscription/successful-subscription.tsx +++ b/services/web/frontend/js/features/subscription/components/successful-subscription/successful-subscription.tsx @@ -5,7 +5,7 @@ import getMeta from '../../../../utils/meta' import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context' import OLRow from '@/features/ui/components/ol/ol-row' import OLCol from '@/features/ui/components/ol/ol-col' -import OLCard from '@/features/ui/components/ol/ol-card' +import OLPageContentCard from '@/features/ui/components/ol/ol-page-content-card' import OLNotification from '@/features/ui/components/ol/ol-notification' function SuccessfulSubscription() { @@ -21,7 +21,7 @@ function SuccessfulSubscription() {
- +

{t('thanks_for_subscribing')}

@@ -106,7 +106,7 @@ function SuccessfulSubscription() { < {t('back_to_your_projects')}

-
+
diff --git a/services/web/frontend/js/features/ui/components/ol/ol-card.tsx b/services/web/frontend/js/features/ui/components/ol/ol-page-content-card.tsx similarity index 57% rename from services/web/frontend/js/features/ui/components/ol/ol-card.tsx rename to services/web/frontend/js/features/ui/components/ol/ol-page-content-card.tsx index 3e5d7e5547..ba6fc75ff9 100644 --- a/services/web/frontend/js/features/ui/components/ol/ol-card.tsx +++ b/services/web/frontend/js/features/ui/components/ol/ol-page-content-card.tsx @@ -1,20 +1,20 @@ -import { Card, CardBody, CardProps } from 'react-bootstrap-5' +import { Card, CardBody } from 'react-bootstrap-5' import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' import { FC } from 'react' +import classNames from 'classnames' // This wraps the Bootstrap 5 Card component but is restricted to the very // basic way we're using it, which is as a container for page content. The // Bootstrap 3 equivalent in our codebase is a div with class "card" -const OLCard: FC = ({ children, ...rest }) => { +const OLPageContentCard: FC<{ className?: string }> = ({ + children, + className, +}) => { return ( - {children} - - } + bs3={
{children}
} bs5={ - + {children} } @@ -22,4 +22,4 @@ const OLCard: FC = ({ children, ...rest }) => { ) } -export default OLCard +export default OLPageContentCard diff --git a/services/web/frontend/stylesheets/bootstrap-5/components/footer.scss b/services/web/frontend/stylesheets/bootstrap-5/components/footer.scss index af26009345..20a41f97c8 100644 --- a/services/web/frontend/stylesheets/bootstrap-5/components/footer.scss +++ b/services/web/frontend/stylesheets/bootstrap-5/components/footer.scss @@ -340,7 +340,8 @@ footer.site-footer { } } -.website-redesign-fat-footer { +.website-redesign-fat-footer, +.website-redesign .fat-footer { .fat-footer-container { @include media-breakpoint-down(sm) { margin: var(--spacing-11) 0; diff --git a/services/web/frontend/stylesheets/bootstrap-5/components/navbar.scss b/services/web/frontend/stylesheets/bootstrap-5/components/navbar.scss index a89ed2bcfb..69cefa6eb2 100644 --- a/services/web/frontend/stylesheets/bootstrap-5/components/navbar.scss +++ b/services/web/frontend/stylesheets/bootstrap-5/components/navbar.scss @@ -211,7 +211,8 @@ } } -.website-redesign-navbar { +.website-redesign-navbar, +.website-redesign .navbar-default { --navbar-title-color: var(--content-primary); --navbar-title-color-hover: var(--content-secondary); --navbar-brand-image-url: url('../../../../public/img/ol-brand/overleaf-black.svg'); diff --git a/services/web/frontend/stylesheets/bootstrap-5/pages/website-redesign.scss b/services/web/frontend/stylesheets/bootstrap-5/pages/website-redesign.scss index 615cf845d0..b393b67756 100644 --- a/services/web/frontend/stylesheets/bootstrap-5/pages/website-redesign.scss +++ b/services/web/frontend/stylesheets/bootstrap-5/pages/website-redesign.scss @@ -232,11 +232,21 @@ .card { --bs-card-bg: var(--neutral-10); --bs-card-border-radius: var(--border-radius-large); - --bs-card-spacer-y: var(--spacing-08); - --bs-card-spacer-x: var(--spacing-08); + + &.page-content-card { + --bs-card-bg: transparent; + } } .badge-premium { --badge-font-weight: 600; } + + .content-alt { + background-color: var(--bg-light-primary); + } + + .page-header { + border-bottom-width: 0; + } }