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

fix: global style in purchase overview widget #143

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 2 additions & 19 deletions src/components/widgets/commitButton/CommitButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,14 @@

import { CommitButtonView } from "@bosonprotocol/react-kit";
import { ElementRef, useCallback, useEffect, useMemo, useRef } from "react";
import { createGlobalStyle } from "styled-components";
import * as yup from "yup";

import { GlobalStyle } from "../styles";
export const commitButtonPath = "/commit-button";

declare const CommitWidgetModal: (props: Record<string, unknown>) => any;
declare const PurchaseOverviewModal: (props: Record<string, unknown>) => any;

const GlobalStyle = createGlobalStyle`
html, body, #root {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;

font-family: "Plus Jakarta Sans", sans-serif;

margin: 0;
padding: 0;
font-style: normal;

height: unset;
}
#root{
display: flex;
}
`;
const emptyObject = {};
const yupStringOrNumber = yup
.mixed<string | number>()
Expand Down
21 changes: 13 additions & 8 deletions src/components/widgets/purchaseOverview/PurchaseOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import { PurchaseOverview as PurchaseOverviewReactKit } from "@bosonprotocol/react-kit";
import { useMemo } from "react";
import * as yup from "yup";

import { GlobalStyle } from "../styles";
export const purchaseOverviewPath = "/purchase-overview";
const emptyObject = {};
export const PurchaseOverview = () => {
Expand All @@ -21,13 +23,16 @@ export const PurchaseOverview = () => {
.validateSync(props);
}, [props]);
return (
<PurchaseOverviewReactKit
lookAndFeel="modal"
modalMargin={validatedProps.modalMargin}
hideModal={
validatedProps.close ||
(() => console.log("close purchase overview modal"))
}
/>
<>
<GlobalStyle />
<PurchaseOverviewReactKit
lookAndFeel="modal"
modalMargin={validatedProps.modalMargin}
hideModal={
validatedProps.close ||
(() => console.log("close purchase overview modal"))
}
/>
</>
);
};
75 changes: 74 additions & 1 deletion src/components/widgets/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled from "styled-components";
import styled, { createGlobalStyle } from "styled-components";

export const Pre = styled.pre`
all: unset;
Expand All @@ -16,3 +16,76 @@ export const Widget = styled.div`
gap: 1rem;
flex-direction: column;
`;

export const GlobalStyle = createGlobalStyle`
html, body, #root {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;

font-family: "Plus Jakarta Sans", sans-serif;

margin: 0;
padding: 0;
font-style: normal;

height: unset;
}
#root{
display: flex;
}


a,
button,
input,
select,
textarea {
text-decoration: none;
&:focus,
&:hover {
outline: none;
}
cursor: pointer;
}

select {
-webkit-appearance: none;
}

input {
user-select: text;
}

* > small {
font-size: 65%;
margin: 0 0.5rem;
opacity: 0.75;
white-space: pre;
}

h1 {
font-size: 3.5rem;
font-weight: 600;
line-height: 1.2;
}
h2 {
font-size: 2rem;
font-weight: 600;
line-height: 1.2;
}
h3 {
font-size: 1.5rem;
font-weight: 600;
line-height: 1.5;
}
h4, h5, h6 {
font-size: 1.25rem;
line-height: 1.5;
margin: 0 0 1rem 0;
}
a, p, span, div {
font-size: 1rem;
line-height: 1.5;
}
`;
Loading