-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: break down JSX into multiple components
- Loading branch information
Showing
6 changed files
with
264 additions
and
226 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
interface DefinitionExamplesProps { | ||
definition: string; | ||
exampleUsage: string; | ||
index: number; | ||
} | ||
|
||
const DefinitionExample = (props: DefinitionExamplesProps) => { | ||
const { definition, exampleUsage, index } = props; | ||
|
||
return ( | ||
<> | ||
{/* definition */} | ||
<p> | ||
<span className='text-lg font-normal sm:text-xl'> | ||
{index + 1}. {definition} | ||
</span> | ||
</p> | ||
|
||
{/* example usage */} | ||
{exampleUsage && ( | ||
<p className='text-base font-light text-gray-400 sm:text-lg'> | ||
“{exampleUsage}” | ||
</p> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default DefinitionExample; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { ErrorStatus, LoadingStatus, NotFoundStatus } from './FetchStatus'; | ||
|
||
interface RenderStatusProps { | ||
status: string; | ||
userInput: string; | ||
} | ||
|
||
const RenderStatus = (props: RenderStatusProps) => { | ||
const { status, userInput } = props; | ||
return ( | ||
<> | ||
{status == 'fetching' && <LoadingStatus />} | ||
{status == 'error' && <ErrorStatus />} | ||
{status == 'no definitions' && <NotFoundStatus userInput={userInput} />} | ||
</> | ||
); | ||
}; | ||
|
||
export default RenderStatus; |
Oops, something went wrong.