-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
225 additions
and
1,230 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 30 additions & 24 deletions
54
frontend/src/pages/Methodology/methodologyComponents/FormulaFormat.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,39 @@ | ||
import React from 'react' | ||
import { FractionFormat, type FractionProps } from './FractionFormat' | ||
import FractionFormat, { type FractionFormatProps } from './FractionFormat' | ||
|
||
type RightSideItem = string | FractionProps | ||
|
||
interface FormulaProps { | ||
leftSide?: string | ||
rightSide: RightSideItem[] | ||
interface FormulaFormatProps { | ||
leftSide?: string | FractionFormatProps | ||
rightSide: Array<string | FractionFormatProps> | ||
} | ||
|
||
const FormulaFormat: React.FC<FormulaProps> = ({ leftSide, rightSide }) => ( | ||
<div className='flex flex-row items-center justify-between overflow-x-scroll rounded-md bg-standardInfo'> | ||
<code className='mx-auto my-0 flex w-max max-w-lg flex-col items-center justify-center self-start border-none bg-opacity-0 text-smallest lg:flex-row'> | ||
<b>{leftSide}</b> | ||
<div>{' = '}</div> | ||
|
||
{rightSide.map((item, index) => ( | ||
<div key={index}> | ||
{typeof item === 'string' ? ( | ||
item | ||
export default function FormulaFormat(props: FormulaFormatProps) { | ||
return ( | ||
<div className='flex w-full flex-row items-center justify-center rounded-md bg-standardInfo '> | ||
<code className='flex flex-col flex-wrap items-center justify-center self-start border-none bg-opacity-0 font-robotoCondensed text-smallest smMd:text-text md:flex-row md:gap-1 lg:text-title'> | ||
<div className='p-2'> | ||
{typeof props.leftSide === 'string' ? ( | ||
props.leftSide | ||
) : ( | ||
<FractionFormat | ||
numerator={item.numerator} | ||
denominator={item.denominator} | ||
numerator={props.leftSide?.numerator} | ||
denominator={props.leftSide?.denominator} | ||
/> | ||
)} | ||
</div> | ||
))} | ||
</code> | ||
</div> | ||
) | ||
<div className='px-2 py-1'>{' = '}</div> | ||
|
||
export default FormulaFormat | ||
{props.rightSide.map((item, index) => ( | ||
<div className='p-2' key={index}> | ||
{typeof item === 'string' ? ( | ||
item | ||
) : ( | ||
<FractionFormat | ||
numerator={item.numerator} | ||
denominator={item.denominator} | ||
/> | ||
)} | ||
</div> | ||
))} | ||
</code> | ||
</div> | ||
) | ||
} |
49 changes: 25 additions & 24 deletions
49
frontend/src/pages/Methodology/methodologyComponents/FractionFormat.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,31 @@ | ||
import React from 'react' | ||
|
||
export interface FractionProps { | ||
export interface FractionFormatProps { | ||
numerator?: any | ||
denominator?: any | ||
} | ||
|
||
export const FractionFormat: React.FC<FractionProps> = ({ | ||
numerator, | ||
denominator, | ||
}) => ( | ||
<div className='flex w-max flex-row items-center justify-center lg:inline-flex '> | ||
{numerator ? ( | ||
<div className='mx-auto my-0 flex flex-col items-center justify-center self-center leading-lhTight'> | ||
<div className='inline-block w-max break-words border-0 border-b border-solid border-black text-center text-smallest'> | ||
{numerator} | ||
</div> | ||
<div className='inline-block w-max text-center text-smallest'> | ||
{denominator} | ||
export default function FractionFormat(props: FractionFormatProps) { | ||
return ( | ||
<div className='flex flex-row items-center justify-center lg:inline-flex '> | ||
{props.numerator ? ( | ||
<div className='flex'> | ||
<span className='text-bigHeader font-light text-altBlack'>(</span> | ||
<div className='mx-auto my-0 flex flex-col items-center justify-center self-center leading-lhTight'> | ||
<div className='inline-block flex-wrap border-0 border-b border-solid border-altBlack p-2 text-center'> | ||
{props.numerator} | ||
</div> | ||
<div className='inline-block w-max p-2 text-center'> | ||
{props.denominator} | ||
</div> | ||
</div> | ||
<span className='text-bigHeader font-light text-altBlack'>)</span> | ||
</div> | ||
</div> | ||
) : ( | ||
<div className='mx-auto my-0 flex flex-col items-center justify-center self-center leading-lhTight'> | ||
<div className='inline-block w-max text-center text-smallest'> | ||
{denominator} | ||
) : ( | ||
<div className='mx-auto my-0 flex flex-col items-center justify-center self-center leading-lhTight'> | ||
<div className='inline-block w-max p-2 text-center '> | ||
{props.denominator} | ||
</div> | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
) | ||
)} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.