Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/integreat-app-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions documentation/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<!DOCTYPE html>
<html lang="en">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be "de"

<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
Copy link
Member

Choose a reason for hiding this comment

The 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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a placeholder inserted at <!-- Region -->?

<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">
Copy link
Member

Choose a reason for hiding this comment

The 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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think those styles can be moved to the .css file.

: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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be moved to the .js file.

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>
5 changes: 5 additions & 0 deletions documentation/scripts.js
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");
Copy link
Member

Choose a reason for hiding this comment

The 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

}
50 changes: 50 additions & 0 deletions documentation/styles.css
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;
}
22 changes: 22 additions & 0 deletions file/index.html
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>
15 changes: 15 additions & 0 deletions file/integreat_search_widget.js
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");
});
44 changes: 44 additions & 0 deletions file/styles.css
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)
}