Skip to content

Commit

Permalink
Merge pull request #1957 from dxc-technology/jialecl-fontsWorkaround
Browse files Browse the repository at this point in the history
fonts css reverted back and changed the approach to load fonts
  • Loading branch information
GomezIvann authored Apr 19, 2024
2 parents 35a1d38 + 4efe42d commit 8d625da
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import styled from "styled-components";
import type { Preview } from "@storybook/react";
import React from "react";
import { disabledRules } from "../test/accessibility/rules/common/disabledRules";
import "../src/common/fonts.css";

const preview: Preview = {
parameters: {
Expand Down Expand Up @@ -33,6 +32,7 @@ const preview: Preview = {
};

const Container = styled.div`
@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:[email protected]");
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans",
"Droid Sans", "Helvetica Neue", sans-serif;
`;
Expand Down
6 changes: 6 additions & 0 deletions lib/src/HalstackContext.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useMemo } from "react";
import Color from "color";
import { createGlobalStyle } from "styled-components";
import {
AdvancedTheme,
OpinionatedTheme,
Expand Down Expand Up @@ -384,10 +385,15 @@ const HalstackProvider = ({ theme, advancedTheme, labels, children }: HalstackPr

return (
<HalstackContext.Provider value={parsedTheme}>
<GlobalStyle />
<HalstackLanguageContext.Provider value={parsedLabels}>{children}</HalstackLanguageContext.Provider>
</HalstackContext.Provider>
);
};

const GlobalStyle = createGlobalStyle`
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;0,800;1,300;1,400;1,600;1,700;1,800&display=swap");
`;

export default HalstackContext;
export { HalstackProvider, HalstackLanguageContext };
2 changes: 0 additions & 2 deletions lib/src/common/fonts.css

This file was deleted.

1 change: 1 addition & 0 deletions lib/src/icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const IconContainer = styled.span<{
icon: string;
filled: boolean;
}>`
@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:[email protected]");
font-family: "Material Symbols Outlined";
font-weight: normal;
font-style: normal;
Expand Down
1 change: 0 additions & 1 deletion lib/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import "./common/fonts.css";
import DxcAlert from "./alert/Alert";
import DxcAccordion from "./accordion/Accordion";
import DxcButton from "./button/Button";
Expand Down

0 comments on commit 8d625da

Please sign in to comment.