Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIM-1987] Mim 1987 logo environment overlay #2829

Merged
merged 20 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
cbc01a1
Add a processor for environment prepending in title
johnnadeluy Jul 12, 2024
0a7a007
Add functionality to prepend environment into title tag in head (wip)
johnnadeluy Jul 15, 2024
fd690bc
Minor adjustments to header and title regex
johnnadeluy Jul 15, 2024
4a1f7ab
Add logging for testing (in test)
johnnadeluy Jul 16, 2024
6ad99bc
Fetch environment from baseUrl in app config
johnnadeluy Jul 16, 2024
ac896d8
Fix environment string on baseUrl match
johnnadeluy Jul 16, 2024
ea60d5c
Fetch environment string from app config instead
johnnadeluy Jul 16, 2024
6aff4dc
Minor code refactoring
johnnadeluy Jul 16, 2024
8cb9946
Merge branch 'develop' of https://github.com/statisticsnorway/mimir i…
johnnadeluy Jul 16, 2024
5f5bbb5
Use optional chain for app config
johnnadeluy Jul 16, 2024
53194c0
Add environment overlay to logo
johnnadeluy Jul 16, 2024
a92e6b6
Add styling to environment text logo overlay
johnnadeluy Jul 16, 2024
64773f1
Minor code refactoring
johnnadeluy Jul 16, 2024
b5563b0
Move getting environment string functionality to utils
johnnadeluy Jul 17, 2024
be39b9b
Add environment string to admin tool applications dashboard and bestb…
johnnadeluy Jul 17, 2024
904b194
Merge branch 'MIM-1986_prepend_environments_in_title' of https://gith…
johnnadeluy Jul 17, 2024
e2db58e
Add environment text to logo for Dashboard
johnnadeluy Jul 17, 2024
601931b
Add environment text logo overlay to Bestbet
johnnadeluy Jul 17, 2024
a180e1f
Merge branch 'develop' of https://github.com/statisticsnorway/mimir i…
johnnadeluy Jul 18, 2024
9cc41f7
Fix environmentString error after develop merge
johnnadeluy Jul 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/resources/admin/tools/bestbet/bestbet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function renderPart(req: XP.Request): XP.Response {
...contentTypesList,
]

const environmentString = getEnvironmentString()
const bestBetComponent = r4XpRender(
'Bestbet',
{
Expand All @@ -107,14 +108,14 @@ function renderPart(req: XP.Request): XP.Response {
contentTypes: contentTypesDropdownItems,
mainSubjects: mainSubjectDropdownItems,
mainSubjectsEnglish: englishMainSubjectDropdownItems,
environmentText: environmentString,
},
req,
{
id: 'app-bestbet',
}
)

const environmentString = getEnvironmentString()
return {
body: render(view, {
...getAssets(),
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/admin/tools/dashboard/dashboard.es6
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ function renderPart(req) {

const model = {
...assets,
environmentText: environmentString ? `[${environmentString}]` : '',
pageContributions,
username: user.displayName,
linkToGuide: userHasAdmin
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/admin/tools/dashboard/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
<a th:href="${linkToGuide}">Veiledning</a>
</nav>
<div class="misc">
<img data-th-src="${logoUrl}" class="logo" alt=""></img>
<div class="logo-container">
<img data-th-src="${logoUrl}" class="logo" alt="" />
<span data-th-if="${environmentText}" data-th-utext="${environmentText}" class="environment-logo-overlay" />
</div>
<h1>Dashboard</h1>
</div>
</header>
Expand Down
21 changes: 17 additions & 4 deletions src/main/resources/assets/styles/_bestbet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,21 @@
padding: 0;
margin-bottom: $spacer * 3;

.logo {
max-width: 184px;
.logo-container {
position: relative;

.logo {
width: 184px;
}

.environment-logo-overlay {
position: absolute;
right: 0;
bottom: 0;

font-weight: bold;
color: $ssb-red-3;
}
}

h1 {
Expand All @@ -34,7 +47,7 @@

.ssb-dropdown, .ssb-input {
margin: 0;

& > * {
margin: 0;
width: 100%;
Expand All @@ -59,4 +72,4 @@
margin-bottom: $spacer;
}
}
}
}
24 changes: 19 additions & 5 deletions src/main/resources/assets/styles/_dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,26 @@
.misc {
display: flex;
width: 100%;
align-items: baseline;
}
align-items: center;

.logo-container {
position: relative;
margin-bottom: 0.6rem;

.logo{
width: 184px;
height: 36px;
}

.logo{
width: 184px;
height: 36px;
.environment-logo-overlay {
position: absolute;
right: 0;
bottom: 0;

font-weight: bold;
color: $ssb-red-3;
}
}
}
}

Expand Down
23 changes: 19 additions & 4 deletions src/main/resources/assets/styles/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ header.ssb-header-wrapper {
}

#header-logo {
&:focus {
outline: $ssb-purple-3 solid 2px;
outline-offset: 2px;
}
position: relative;

&:focus {
outline: $ssb-purple-3 solid 2px;
outline-offset: 2px;
}

.logo {
width: 248px;
Expand All @@ -110,6 +112,19 @@ header.ssb-header-wrapper {
height: 36px;
}
}

.environment-logo-overlay {
position: absolute;
right: 0;
bottom: .2rem;

font-weight: bold;
color: $ssb-red-3;

@include media-breakpoint-down(md) {
bottom: 0;
}
}
}

.hamburger {
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/lib/ssb/parts/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { get, Content } from '/lib/xp/content'
import { assetUrl } from '/lib/xp/portal'
import { localize } from '/lib/xp/i18n'
import { createMenuTree, parseTopLinks } from '/lib/ssb/parts/menu'
import { pathFromStringOrContent } from '/lib/ssb/utils/utils'
import { getEnvironmentString, pathFromStringOrContent } from '/lib/ssb/utils/utils'
import { type Language } from '/lib/types/language'
import { type HeaderContent } from '/lib/types/header'
import { type Header } from '/site/content-types'
Expand All @@ -26,6 +26,7 @@ export function getHeaderContent(language: Language): HeaderContent | undefined
key: 'logoAltText',
locale: language.code,
}),
environmentText: getEnvironmentString(),
searchResultPageUrl: headerContent.data.searchResultPage
? pathFromStringOrContent(headerContent.data.searchResultPage)
: undefined,
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/lib/types/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface HeaderContent {
logoUrl: string
logoSrc: string
logoAltText: string
environmentText: string
searchResultPageUrl?: string
searchResult?: string
searchText: string
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/react4xp/_entries/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ function Header(props: HeaderContent) {
<div className='misc top-row flex-row justify-space-between flex-wrap'>
<a id='header-logo' className='plainLink' href={logoUrl}>
<img src={logoSrc} alt={logoAltText ? logoAltText : ' '} className='logo' />
{props.environmentText ? <span className='environment-logo-overlay'>[{props.environmentText}]</span> : null}
</a>

<button
Expand Down
8 changes: 7 additions & 1 deletion src/main/resources/react4xp/bestbet/Bestbet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const BestBetContext = createContext()

interface BestbetProps {
logoUrl?: string
environmentText?: string
bestBetListServiceUrl?: string
contentSearchServiceUrl?: string
contentStudioBaseUrl?: string
Expand Down Expand Up @@ -397,7 +398,12 @@ function Bestbet(props: BestbetProps) {
<Container fluid>
<Row className='bestbet-header'>
<Col className='flex-row align-items-center'>
<img src={props.logoUrl} className='logo' />
<div className='logo-container'>
<img src={props.logoUrl} className='logo' />
{props.environmentText ? (
<span className='environment-logo-overlay'>[{props.environmentText}]</span>
) : null}
</div>
<Title size={1}>Best bet søk</Title>
</Col>
</Row>
Expand Down
Loading