-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add search_widget and introduction #1
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Document</title> | ||
<link rel="stylesheet" href="styles.css"> | ||
</head> | ||
<body> | ||
<div class="content"> | ||
<div> | ||
<h1>Integreat</h1> | ||
<p>Es gibt viele Möglichkeiten die Suche von <a href="">Integreat</a> auf ihrer Website einzubetten. </p> | ||
</div> | ||
<div class="row"> | ||
<div> | ||
<h2>Das Such-Widget</h2> | ||
<div> | ||
<h3>HTML einbetten</h3> | ||
<textarea id="integreat_textarea_html" class="integreat_class_input"> | ||
<div id="integreat-search-widget"> | ||
Comment on lines
+21
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Formatting is slightly off here. I usually use prettier in HTML/JS projects: https://prettier.io/ |
||
<img src="./assets/integreat-app-logo.png"> | ||
<p>Mehrsprachige Informationen in <!-- Region --> finden!</p> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should there be a placeholder inserted at |
||
<form method="get"> | ||
<input class="integreat_search" id="integreat_search" name="query" placeholder="z.B. Sprachkurse"> | ||
<input class="integreat_submit" id="integreat_submit" type="submit" value="SUCHEN"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can also use text-transform to make something uppercase: https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform |
||
</form> | ||
</div> | ||
</textarea> | ||
<button onclick="add_to_clipboard('integreat_textarea_html')" id="integreat_button_search_widget">Copy to Clipboard</button> | ||
</div> | ||
<div> | ||
<h3> | ||
CSS einbetten | ||
</h3> | ||
<textarea id="integreat_textarea_css" class="integreat_class_input"> | ||
<style> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think those styles can be moved to the |
||
:root { | ||
--yellow: #ffd905; | ||
--black: #3a4049; | ||
--white: #fff; | ||
} | ||
|
||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
form { | ||
height: 45pt; | ||
margin: 15px 0; | ||
width: 302.25pt; | ||
position: relative; | ||
} | ||
|
||
.integreat_search { | ||
border: 0; | ||
width: 100%; | ||
height: 100%; | ||
padding: 10px; | ||
font-size: 17px; | ||
position: absolute; | ||
border-radius: 25px; | ||
box-shadow: 0px 0px 3px rgba(0,0,0,0.23); | ||
} | ||
|
||
.integreat_submit { | ||
right: 0; | ||
border: 0; | ||
height: 100%; | ||
width: 93.75pt; | ||
font-size: 17px; | ||
padding: 5px 10px; | ||
position: absolute; | ||
border-radius: 25px; | ||
background-color: var(--yellow); | ||
} | ||
|
||
.integreat_submit:hover { | ||
color: var(--white); | ||
background-color: var(--black) | ||
} | ||
</style> | ||
</textarea> | ||
<button onclick="add_to_clipboard('integreat_textarea_css')" id="integreat_button_search_widget">Copy to Clipboard</button> | ||
</div> | ||
<div><h3>Javascript einbetten</h3> | ||
<textarea id="integreat_textarea_js" class="integreat_class_input"> | ||
<script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be moved to the |
||
const data = { | ||
city: "Augsburg", | ||
default_language: "de" | ||
} | ||
|
||
let button = document.querySelector("form"); | ||
let target_url = "https://www.integreat.app/" + data.city.toLowerCase() + "/" + data.default_language + "/search"; | ||
button.addEventListener("submit", function(event){ | ||
event.preventDefault(); | ||
let keyword = document.getElementById("integreat_search").value; | ||
if (keyword.length > 0) { | ||
target_url = target_url + "/?query=" + keyword; | ||
} | ||
window.open(target_url, "_blank"); | ||
}); | ||
</script> | ||
</textarea> | ||
<button onclick="add_to_clipboard('integreat_textarea_js')" id="integreat_button_search_widget">Copy to Clipboard</button> | ||
</div> | ||
</div> | ||
<div class="align-items"> | ||
<iframe src="../file/index.html" frameborder="0" width="512" height="256"></iframe> | ||
</div> | ||
</div> | ||
</div> | ||
<script src="scripts.js"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function add_to_clipboard(id) { | ||
let input_search_widget = document.getElementById(id) | ||
input_search_widget.select(); | ||
document.execCommand("Copy"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I never used any copy API of the browser. But this API seems to be removed: https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
:root { | ||
--yellow: #ffd905; | ||
--black: #3a4049; | ||
--white: #fff; | ||
} | ||
|
||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
.row { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
.content { | ||
width: 90%; | ||
max-width: 1626px; | ||
margin: 0 auto; | ||
} | ||
|
||
.circle { | ||
border-radius: 50%; | ||
background-color: var(--black); | ||
color: var(white); | ||
} | ||
|
||
button { | ||
border: 0; | ||
padding: 12px 50px; | ||
color: var(--black); | ||
background-color: var(--yellow); | ||
} | ||
|
||
textarea { | ||
width: 100%; | ||
resize: none; | ||
min-width: 512px; | ||
min-height: 200px; | ||
margin-bottom: 10px; | ||
} | ||
|
||
button:hover { | ||
cursor: pointer; | ||
} | ||
|
||
.align-items { | ||
display: flex; | ||
align-items: center; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="styles.css"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<div id="integreat-search-widget"> | ||
<img src="../assets/integreat-app-logo.png"> | ||
<p>Mehrsprachige Informationen in <!-- Region --> finden!</p> | ||
<form method="get"> | ||
<input class="integreat_search" id="integreat_search" name="query" placeholder="z.B. Sprachkurse"> | ||
<input class="integreat_submit" id="integreat_submit" type="submit" value="SUCHEN"> | ||
</form> | ||
</div> | ||
|
||
<script src="./integreat_search_widget.js"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const data = { | ||
city: "Augsburg", | ||
default_language: "de" | ||
} | ||
|
||
let button = document.querySelector("form"); | ||
let target_url = "https://www.integreat.app/" + data.city.toLowerCase() + "/" + data.default_language + "/search"; | ||
button.addEventListener("submit", function(event){ | ||
event.preventDefault(); | ||
let keyword = document.getElementById("integreat_search").value; | ||
if (keyword.length > 0) { | ||
target_url = target_url + "/?query=" + keyword; | ||
} | ||
window.open(target_url, "_blank"); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
:root { | ||
--yellow: #ffd905; | ||
--black: #3a4049; | ||
--white: #fff; | ||
} | ||
|
||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
form { | ||
height: 45pt; | ||
margin: 15px 0; | ||
width: 302.25pt; | ||
position: relative; | ||
} | ||
|
||
.integreat_search { | ||
border: 0; | ||
width: 100%; | ||
height: 100%; | ||
padding: 10px; | ||
font-size: 17px; | ||
position: absolute; | ||
border-radius: 25px; | ||
box-shadow: 0px 0px 3px rgba(0,0,0,0.23); | ||
} | ||
|
||
.integreat_submit { | ||
right: 0; | ||
border: 0; | ||
height: 100%; | ||
width: 93.75pt; | ||
font-size: 17px; | ||
padding: 5px 10px; | ||
position: absolute; | ||
border-radius: 25px; | ||
background-color: var(--yellow); | ||
} | ||
|
||
.integreat_submit:hover { | ||
color: var(--white); | ||
background-color: var(--black) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably be "de"