Skip to content

Commit

Permalink
Merge pull request #544 from City-of-Helsinki/UHF-8070-fix-heading-st…
Browse files Browse the repository at this point in the history
…yles-with-hds

UHF-8070: fix heading styles with hds
  • Loading branch information
Jussiles authored Feb 15, 2023
2 parents 42f2094 + c124c81 commit 85a7ff2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/js/linkedevents.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion hdbt.theme
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,9 @@ function hdbt_preprocess_paragraph__event_list(&$variables) {
$eventUrl = $linkedEvents->getEventsRequest($params, $settings['field_event_count']);
$settings['events_api_url'] = $eventUrl;
$settings['request_url'] = $eventUrl;
$settings['places'] = $linkedEvents->getPlaceslist($eventUrl);
if ($paragraph->get('field_event_location')->first()->getValue()['value']) {
$settings['places'] = $linkedEvents->getPlaceslist($eventUrl);
}
}

$booleanFields = [
Expand Down
1 change: 0 additions & 1 deletion src/js/react/apps/linkedevents/components/DateSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { DateInput } from 'hds-react';
import Collapsible from './Collapsible';
import { QueryBuilder } from '../utils/QueryBuilder';
Expand Down
3 changes: 3 additions & 0 deletions src/js/react/apps/linkedevents/containers/SearchContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import FormContainer from './FormContainer';
import ResultsContainer from './ResultsContainer';
import type Event from '../types/Event';
import { queryBuilderAtom, urlAtom } from '../store';
import removeHdsNormalizeStyleElementFromDom from '@/react/common/hooks/removeHdsNormalizeStyleElementFromDom';

type ResponseType = {
data: Event[];
Expand All @@ -27,6 +28,8 @@ const SearchContainer = () => {
const queryBuilder = useAtomValue(queryBuilderAtom);
const url = useAtomValue(urlAtom) || queryBuilder?.getUrl();

removeHdsNormalizeStyleElementFromDom();

if (!queryBuilder) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { useLayoutEffect } from 'react';

const removeHdsNormalizeStyleElementFromDom = () => {
useLayoutEffect(() => {
const styleElements = document.querySelectorAll('style');
Object.keys(styleElements).forEach((key: any) => {
if (styleElements[key].innerHTML.startsWith('/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */')) {
styleElements[key].remove();
}
});
});
};

export default removeHdsNormalizeStyleElementFromDom;

0 comments on commit 85a7ff2

Please sign in to comment.