-
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.
Merge pull request #6 from izzymadethat/version-1.1-isaiah
Version 1.1 isaiah
- Loading branch information
Showing
10 changed files
with
276 additions
and
139 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 |
---|---|---|
@@ -1,22 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/public/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Dictionary App</title> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css"> | ||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link href="https://fonts.googleapis.com/css2?family=Pathway+Extreme:opsz@8..144&display=swap" rel="stylesheet"> | ||
<img src="/src/assets/book.png" class="book"> | ||
<link | ||
rel="stylesheet" | ||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" | ||
/> | ||
<link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Pathway+Extreme:opsz@8..144&display=swap" | ||
rel="stylesheet" | ||
/> | ||
<link | ||
href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css" | ||
rel="stylesheet" | ||
/> | ||
<img src="/src/assets/book.png" class="book" /> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
<footer> Imani Roberts © 2023</footer> | ||
<footer>Imani Roberts © 2023</footer> | ||
<script type="module" src="/src/main.jsx"></script> | ||
</body> | ||
|
||
</html> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* DefinitionAudio Component | ||
* | ||
* This component recieves audio url from API and returns | ||
* audio player if src exists, otherwise it returns null | ||
* | ||
* @param {string} props.audioSrc | ||
* @returns Audio Player component for phonetic spelling of word | ||
*/ | ||
|
||
const DefinitionAudio = ({ audioSrc }) => { | ||
if (!audioSrc) return null; | ||
return <audio className="audio" controls src={audioSrc}></audio>; | ||
}; | ||
|
||
export default DefinitionAudio; |
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,50 @@ | ||
import DefinitionAudio from "./DefinitionAudio"; | ||
import MeaningGrid from "./MeaningGrid"; | ||
import "../css/definition.css"; | ||
/** | ||
* DefinitionDisplay Component | ||
* | ||
* Top-level component for displaying definition results. | ||
* Renders phonetic information and meanings grid. | ||
* | ||
* @param {Object} props - Component props. | ||
* @param {Object} props.definition - Definition object from state. | ||
* @param {string} props.userInput - User input string. | ||
* @param {string} props.word - Word string for comparison. | ||
* @returns {JSX.Element | null} Definition layout or null if conditions aren't met. | ||
*/ | ||
|
||
const DefinitionDisplay = ({ definition, userInput, word }) => { | ||
if (!definition || definition.error || userInput !== word) { | ||
return null; | ||
} | ||
|
||
const phonetics = definition.phonetics; | ||
const meanings = definition.meanings; | ||
|
||
return ( | ||
<div className="definition"> | ||
{/* Phonetic spelling and audio is available */} | ||
{phonetics && ( | ||
<div className="definition__audio"> | ||
<p>{phonetics[0].text}</p> | ||
|
||
{/* Phonetics audio player */} | ||
<DefinitionAudio audioSrc={phonetics[1].audio} /> | ||
</div> | ||
)} | ||
<br /> | ||
|
||
<h4 className="definition__header"> | ||
The definition(s) of{" "} | ||
<span className="definition__user-input">{userInput}</span>: | ||
</h4> | ||
|
||
<br /> | ||
|
||
<MeaningGrid meanings={meanings} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default DefinitionDisplay; |
Oops, something went wrong.