aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorKumar Priyansh <[email protected]>2020-08-31 01:21:41 +0530
committerKumar Priyansh <[email protected]>2020-08-31 01:21:41 +0530
commit8fc8fdd041263b69de149c68d29670597d6cfa38 (patch)
tree3930b67d851349cfcc89f22e8b6ffdc5cddded03 /app
parent8ca188b39f3e7b532bd5dc87adcd6b2e39453743 (diff)
downloaddictionary-8fc8fdd041263b69de149c68d29670597d6cfa38.tar.xz
dictionary-8fc8fdd041263b69de149c68d29670597d6cfa38.zip
Added examples
Diffstat (limited to 'app')
-rw-r--r--app/css/style.css15
-rw-r--r--app/scripts/search.js14
2 files changed, 28 insertions, 1 deletions
diff --git a/app/css/style.css b/app/css/style.css
index 73abc7b..11c0805 100644
--- a/app/css/style.css
+++ b/app/css/style.css
@@ -41,6 +41,7 @@ body {
color: #bdbdbd;
text-transform: uppercase;
padding-left: 5px;
+ user-select: none;
}
.results {
@@ -51,7 +52,7 @@ body {
}
.wordType {
- color: #e2e2e2;
+ color: #ffffff96;
font-size: 1.5rem;
margin-bottom: 0px;
}
@@ -59,4 +60,16 @@ body {
.definition {
margin-top: 5px;
font-size: 2rem;
+ margin-bottom: 20px;
+}
+
+.exampleArea {
+ color: #ffffff96;
+ margin-top: 0px;
+}
+
+.example {
+ font-size: 0.75rem;
+ color: #ffffff96;
+ font-style: italic;
}
diff --git a/app/scripts/search.js b/app/scripts/search.js
index f7f949c..0da2c91 100644
--- a/app/scripts/search.js
+++ b/app/scripts/search.js
@@ -41,6 +41,20 @@ searchBox.addEventListener('keypress', (e) => {
definition.innerHTML = detail.def;
definition.className = 'definition';
results.appendChild(definition);
+
+ if (detail.exp.length) {
+ const exampleArea = document.createElement('p');
+ exampleArea.innerHTML = 'Examples:';
+ exampleArea.className = 'exampleArea';
+ results.appendChild(exampleArea);
+ }
+
+ detail.exp.forEach(example => {
+ const currentExample = document.createElement('p');
+ currentExample.innerHTML = `${example}`;
+ currentExample.className = 'example';
+ results.appendChild(currentExample);
+ });
});
});
}