Skip to content

Commit c68ef5f

Browse files
authored
Merge branch 'master' into salcik/pra-58-ladnie-uporzadkowac-tlumaczenia
2 parents d02c25e + a64aef1 commit c68ef5f

File tree

19 files changed

+765
-133
lines changed

19 files changed

+765
-133
lines changed

src/assets/starsIconGroupWhite.svg

Lines changed: 110 additions & 0 deletions
Loading

src/components/Button.astro

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ interface Props {
33
id: string;
44
fontSize?: string;
55
variant: "primary" | "secondary" | "outlined";
6+
type: "button" | "submit" | "reset" | null | undefined,
67
}
78
8-
const { id, variant, fontSize = "1em" } = Astro.props as Props;
9+
const { id, variant, fontSize = "1em", type="button" } = Astro.props as Props;
910
1011
const variantClassMap: Record<string, string> = {
1112
primary: "dark",
@@ -15,15 +16,15 @@ const variantClassMap: Record<string, string> = {
1516
const buttonClass = variantClassMap[variant] ?? "outlined";
1617
---
1718

18-
<button type="button" id={id} class={`button ${buttonClass}`}>
19+
<button type={type} id={id} class={`button ${buttonClass}`}>
1920
<slot />
2021
</button>
2122

2223
<style define:vars={{ fontSize }}>
2324
.dark {
2425
color: var(--light);
2526
background-color: var(--dark);
26-
box-shadow: 0px 5px 5px var(--dark);
27+
box-shadow: 0px 5px 5px rgba(12, 12, 12, 0.33);
2728
}
2829

2930
.light {
@@ -43,6 +44,9 @@ const buttonClass = variantClassMap[variant] ?? "outlined";
4344
padding: 15px 30px;
4445
cursor: pointer;
4546
font-weight: 700;
47+
width: 100%;
48+
4649
font-size: var(--fontSize);
50+
font-family: var(--font-ubuntu);
4751
}
4852
</style>

src/components/Input.astro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const props = Astro.props as InputProps;
2020
font-size: 16px;
2121
padding: 8px;
2222
font-family: var(--ubuntu);
23+
width: 100%;
2324
}
2425

2526
.input-container {
@@ -32,6 +33,7 @@ const props = Astro.props as InputProps;
3233
border-bottom: 2px var(--placeholder) solid;
3334
caret-color: var(--placeholder);
3435
transition: all 0.3s ease-in-out;
36+
width: 100%;
3537
}
3638

3739
.input-container:focus-within {

src/components/Textarea.astro

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
import type { JSX } from 'astro/jsx-runtime';
3+
4+
type textareaProps = JSX.IntrinsicElements['textarea'];
5+
6+
const props = Astro.props as textareaProps;
7+
---
8+
<div class="textarea-container">
9+
<textarea {...props} />
10+
</div>
11+
<style>
12+
13+
textarea {
14+
outline: 0;
15+
border: 0;
16+
font-size: 16px;
17+
padding: 8px;
18+
font-family: var(--ubuntu);
19+
resize: none;
20+
overflow-wrap: break-word;
21+
white-space: pre-wrap;
22+
width: 100%;
23+
}
24+
25+
.textarea-container {
26+
display: flex;
27+
justify-content: center;
28+
align-items: center;
29+
outline: var(--placeholder);
30+
color: var(--placeholder);
31+
border: none;
32+
border-bottom: 2px var(--placeholder) solid;
33+
caret-color: var(--placeholder);
34+
transition: all 0.3s ease-in-out;
35+
}
36+
37+
.textarea-container:focus-within {
38+
outline: var(--primary);
39+
color: black;
40+
border: none;
41+
border-bottom: 2px var(--primary) solid;
42+
caret-color: var(--primary);
43+
}
44+
</style>

src/global.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
:root {
2+
--primaryText: #0c0c0c;
3+
--secondaryText: #ffffff;
24
--dark: #0c0c0cff;
35
--darkDimmed: #0c0c0c2b;
46
--primary: #6809EE;
@@ -7,6 +9,7 @@
79
--secondaryLight: #E1E6F1;
810
--light: #ffffffff;
911
--lightDimmed: #e1e6f14d;
12+
--lightTransparent: #ffffff1a;
1013
--placeholder: #AEB4C2;
1114
--success: #73FF8D;
1215
--warning: #F9FF3C;
@@ -19,5 +22,5 @@ body {
1922
margin: 0;
2023
width: 100%;
2124
height: 100%;
22-
overflow-x: hidden;
25+
scroll-behavior: smooth;
2326
}

src/layouts/Layout.astro

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ import Navbar from "../sections/Navbar.astro";
2929
import { getLangForRedirect } from "../i18n/utils";
3030
const lang = getLangForRedirect(new URL(window.location.href));
3131

32-
const userLang = navigator.language || "pl";
32+
const userLang = localStorage.getItem("lang") || navigator.language || "pl";
3333

3434
if (!userLang.startsWith("pl") && lang !== "en") {
35-
const meta = document.createElement("meta");
36-
meta.httpEquiv = "refresh";
37-
meta.content = "0;url=/en/";
38-
document.head.appendChild(meta);
35+
const meta = document.createElement("meta");
36+
meta.httpEquiv = "refresh";
37+
meta.content = `0;url=/en/`;
38+
document.head.appendChild(meta);
3939
}
40-
</script>
40+
</script>
4141
</body>
4242
</html>
4343

src/pages/en/index.astro

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import Offers from '../../sections/Offers.astro';
77
import Carousel from '../../sections/Carousel.astro';
88
import Icons from '../../sections/Icons.astro';
99
import Table from '../../sections/Table.astro';
10-
import Input from '../../components/Input.astro';
10+
import ContactForm from '../../sections/ContactForm.astro';
11+
1112
1213
// Welcome to Astro! Wondering what to do next? Check out the Astro documentation at https://docs.astro.build
1314
// Don't want to use any of this? Delete everything in this file, the `assets`, `components`, and `layouts` directories, and start fresh.
@@ -21,7 +22,7 @@ import Input from '../../components/Input.astro';
2122
<Icons />
2223
<Table />
2324
<Carousel />
24-
<Input type="email" id="test" placeholder="[email protected]"/>
25+
<ContactForm />
2526
</Layout>
2627

2728
<style>

src/pages/index.astro

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
---
2-
import Footer from "../sections/Footer.astro";
3-
import Navbar from "../sections/Navbar.astro";
4-
import Layout from "../layouts/Layout.astro";
5-
import Hero from "../sections/Hero.astro";
6-
import Offers from "../sections/Offers.astro";
7-
import Icons from "../sections/Icons.astro";
8-
import Carousel from "../sections/Carousel.astro";
9-
import Table from "../sections/Table.astro";
2+
import Footer from '../sections/Footer.astro';
3+
import Navbar from '../sections/Navbar.astro';
4+
import Layout from '../layouts/Layout.astro';
5+
import Hero from '../sections/Hero.astro';
6+
import Offers from '../sections/Offers.astro';
7+
import Icons from '../sections/Icons.astro';
8+
import Carousel from '../sections/Carousel.astro';
9+
import Table from '../sections/Table.astro';
10+
import ContactForm from '../sections/ContactForm.astro';
1011
1112
// Welcome to Astro! Wondering what to do next? Check out the Astro documentation at https://docs.astro.build
1213
// Don't want to use any of this? Delete everything in this file, the `assets`, `components`, and `layouts` directories, and start fresh.
1314
---
1415

1516
<Layout>
16-
<div class="infoContainer">
17-
<Hero />
18-
<Offers />
19-
</div>
20-
<Icons />
21-
<Table />
22-
<Carousel />
17+
<div class="infoContainer">
18+
<Hero />
19+
<Offers />
20+
</div>
21+
<Icons />
22+
<Table />
23+
<Carousel />
24+
<ContactForm />
2325
</Layout>
2426

2527
<style>

src/scripts/NavbarScripts.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { getLangFromUrl } from "../i18n/utils";
1+
import { langs } from "../i18n/ui";
2+
import { getLangForRedirect, getLangFromUrl } from "../i18n/utils";
23

34
document.getElementsByClassName("hamburger-button")[0].addEventListener("click", () => {
45
document.getElementsByClassName("hamburger-menu")[0].classList.toggle("hamburger-menu-open");
@@ -14,3 +15,23 @@ document.getElementsByClassName("logoContainer")[0].addEventListener("click", ()
1415

1516
window.location.assign(`/`);
1617
});
18+
19+
document.getElementById("langSwitch").addEventListener("click", () => {
20+
const lang = getLangFromUrl(new URL(window.location.href));
21+
const currentLangIndex = langs.indexOf(lang);
22+
23+
const nextLang = langs[(currentLangIndex + 1) % langs.length];
24+
const targetUrl = nextLang.startsWith("pl") ? "/" : `/${nextLang}/`;
25+
26+
const meta = document.createElement("meta");
27+
meta.httpEquiv = "refresh";
28+
meta.content = `0;url=${targetUrl}`;
29+
30+
if (!nextLang.startsWith("pl")) {
31+
localStorage.setItem("lang", "en-US");
32+
}else{
33+
localStorage.setItem("lang", "pl-PL");
34+
}
35+
36+
document.head.appendChild(meta);
37+
})

src/scripts/api.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import type { FormFields } from "../types";
2+
3+
const API_URL = "https://craftserve.zendesk.com/api/v2/requests.json"
4+
5+
export const sendTicket = async (data: FormFields) => {
6+
try{
7+
const request = await fetch(API_URL, {
8+
method: "POST",
9+
headers: {
10+
"Content-Type": "application/json"
11+
},
12+
body: JSON.stringify({
13+
"request": {
14+
"requester": {
15+
"name": `${data.name} ${data.surname}`,
16+
"email": `${data.email}`
17+
},
18+
"subject": `[AGENCY] ${data.subject}`,
19+
"comment": {
20+
"body": `
21+
Firma: ${data.company}\n
22+
Numer telefonu kontaktowego: ${data.phone}\n
23+
Treść: ${data.content}
24+
`
25+
},
26+
"tags": ["agency", "contact_form"]
27+
}
28+
})
29+
})
30+
31+
const response = await request.json();
32+
33+
return response;
34+
}catch(err){
35+
console.warn(err);
36+
return "Error has occured while creating ticket";
37+
}
38+
}

0 commit comments

Comments
 (0)