Skip to content

Commit

Permalink
fix: relocate CSS container
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgoff committed Jun 13, 2024
1 parent c96bc00 commit d3ad90f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
9 changes: 9 additions & 0 deletions components/calculators/Interactive/styles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"use client";
import { token } from "@rubin-epo/epo-react-lib/styles";
import styled from "styled-components";

export const MathContainer = styled.div`
Expand All @@ -10,6 +11,14 @@ export const MathContainer = styled.div`
gap: var(--math-gap);
justify-items: left;
min-width: 50%;
@container (min-width: ${token("BREAK_MOBILE_MIN")}) {
font-size: 125%;
}
@container (min-width: ${token("BREAK_TABLET_MIN")}) {
font-size: 150%;
}
`;

export const Inputs = styled.form`
Expand Down
9 changes: 9 additions & 0 deletions components/calculators/interactive/styles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"use client";
import { token } from "@rubin-epo/epo-react-lib/styles";
import styled from "styled-components";

export const MathContainer = styled.div`
Expand All @@ -10,6 +11,14 @@ export const MathContainer = styled.div`
gap: var(--math-gap);
justify-items: left;
min-width: 50%;
@container (min-width: ${token("BREAK_MOBILE_MIN")}) {
font-size: 125%;
}
@container (min-width: ${token("BREAK_TABLET_MIN")}) {
font-size: 150%;
}
`;

export const Inputs = styled.form`
Expand Down
5 changes: 3 additions & 2 deletions components/questions/Calculator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import useAnswer from "@/hooks/useAnswer";
import { isNullish } from "@/lib/utils";
import { WidgetInput } from "@/types/answers";
import InteractiveCalculator from "@/components/calculators/Interactive";
import QuestionNumber from "../QuestionNumber";
import * as Styled from "./styles";
import { Equation } from "@/types/calculators";

Expand All @@ -31,7 +32,7 @@ const CalculatorQuestion: FunctionComponent<CalculatorQuestionProps> = ({
if (isNullish(equation)) return null;

return (
<Styled.QuestionNumber {...{ id }}>
<QuestionNumber {...{ id }}>
<label htmlFor={id}>{questionText}</label>
<Styled.CalculatorWrapper>
<InteractiveCalculator
Expand All @@ -43,7 +44,7 @@ const CalculatorQuestion: FunctionComponent<CalculatorQuestionProps> = ({
}}
/>
</Styled.CalculatorWrapper>
</Styled.QuestionNumber>
</QuestionNumber>
);
};

Expand Down
13 changes: 0 additions & 13 deletions components/questions/Calculator/styles.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
"use client";
import styled from "styled-components";
import { token } from "@rubin-epo/epo-react-lib/styles";
import BaseQuestionNumber from "../QuestionNumber";

export const CalculatorWrapper = styled.div`
display: flex;
justify-content: center;
font-size: 100%;
color: var(--neutral95, #1f2121);
@container (min-width: ${token("BREAK_MOBILE_MIN")}) {
font-size: 125%;
}
@container (min-width: ${token("BREAK_TABLET_MIN")}) {
font-size: 150%;
}
`;

export const QuestionNumber = styled(BaseQuestionNumber)`
container-type: inline-size;
`;
2 changes: 0 additions & 2 deletions components/questions/QuestionNumber/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const QuestionNumber: FunctionComponent<
> = ({ id, direction = "block", className, children }) => {
const questions = useQuestions();

const maxIndex = questions.byAll.length - 1;
const questionIndex = questions.byAll.findIndex(
(question) => question.id === id
);
Expand All @@ -25,7 +24,6 @@ const QuestionNumber: FunctionComponent<
value={questionIndex + 1}
data-direction={direction}
className={className}
style={{ "--z-index-dropdown-open": maxIndex - questionIndex }}
>
{children}
</Styled.Number>
Expand Down

0 comments on commit d3ad90f

Please sign in to comment.