Skip to content

Commit b33b4a8

Browse files
StanG4313d0rich
andauthored
Contacts customization added (#23)
* Contacts customization added * specific contacts substitute default contacts * Document contact us section customization feature * code snippet fix --------- Co-authored-by: Nikolai Dorofeev <[email protected]>
1 parent 5555fd5 commit b33b4a8

File tree

6 files changed

+107
-40
lines changed

6 files changed

+107
-40
lines changed

app.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ interface SocialLinkConfigOptions {
2424
disabled?: boolean
2525
}
2626

27+
interface ContactConfigOptions {
28+
type: 'email' | 'phone'
29+
contact: string
30+
}
31+
2732
interface ExactproDocsOptions {
2833
/**
2934
* Title of the documentation.
@@ -72,6 +77,7 @@ interface ExactproDocsOptions {
7277
linkedin?: SocialLinkConfigOptions
7378
youtube?: SocialLinkConfigOptions
7479
}
80+
contacts: ContactConfigOptions[]
7581
}
7682

7783
declare module 'nuxt/schema' {

components/ep/layout/Footer.vue

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -30,47 +30,11 @@
3030
<span>Build Software to Test Software</span>
3131
</div>
3232

33+
<!-- Contact Us -->
3334
<div class="flex flex-col items-center md:items-start">
3435
<h2 class="e-footer__h2">Contact Us</h2>
3536
<hr class="e-footer__hr" />
36-
<ul class="flex flex-col justify-center m-1">
37-
<li>
38-
<a href="mailto:[email protected]"
39-
><Icon
40-
name="heroicons:envelope"
41-
size="1.5em"
42-
class="inline-block mr-3"
43-
44-
>
45-
</li>
46-
<li>
47-
<a href="mailto:[email protected]"
48-
><Icon
49-
name="heroicons:envelope"
50-
size="1.5em"
51-
class="inline-block mr-3"
52-
53-
>
54-
</li>
55-
<li>
56-
<a href="tel:+4402033191644"
57-
><Icon
58-
name="heroicons:phone"
59-
size="1.5em"
60-
class="inline-block mr-3"
61-
/>+44 (0) 20 3319 1644</a
62-
>
63-
</li>
64-
<li>
65-
<a href="tel:+16463403000"
66-
><Icon
67-
name="heroicons:phone"
68-
size="1.5em"
69-
class="inline-block mr-3"
70-
/>+1 (646) 340 3000</a
71-
>
72-
</li>
73-
</ul>
37+
<EpLayoutFooterContacts class="pt-2" />
7438
</div>
7539

7640
<div class="flex flex-col items-center md:items-start">
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<!--
2+
~ Copyright 2023 Exactpro (Exactpro Systems Limited)
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<script setup lang="ts">
18+
const config = useAppConfig()
19+
let contacts = config.exactproDocs.contacts
20+
type Contact = (typeof config.exactproDocs.contacts)[number]
21+
22+
if (!contacts?.length) {
23+
contacts = [
24+
{
25+
contact: '[email protected]',
26+
type: 'email'
27+
},
28+
{
29+
contact: '[email protected]',
30+
type: 'email'
31+
},
32+
{
33+
contact: '+4402033191644',
34+
type: 'phone'
35+
},
36+
{
37+
contact: '+16463403000',
38+
type: 'phone'
39+
}
40+
]
41+
}
42+
43+
function getContactIcon(contact: Contact) {
44+
if (contact.type === 'email') {
45+
return 'heroicons:envelope'
46+
}
47+
return 'heroicons:phone'
48+
}
49+
50+
function getContactLink(contact: Contact) {
51+
if (contact.type === 'email') {
52+
return `mailto:${contact.contact}`
53+
}
54+
return `tel:${contact.contact}`
55+
}
56+
</script>
57+
58+
<template>
59+
<ul class="flex flex-col justify-center m-1">
60+
<li v-for="(contact, index) in contacts" :key="index">
61+
<a :href="getContactLink(contact)"
62+
><Icon
63+
:name="getContactIcon(contact)"
64+
size="1.5em"
65+
class="inline-block mr-3"
66+
/>{{ contact.contact }}</a
67+
>
68+
</li>
69+
</ul>
70+
</template>

docs/app.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default defineAppConfig({
2727
url: 'https://github.com/exactpro/docs-toolkit'
2828
}
2929
},
30+
contacts: [],
3031
seo: {
3132
robots: [{ UserAgent: '*' }, { Allow: '/' }],
3233
sitemap: {

docs/content/3.customization.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,32 @@ export default defineAppConfig({
6161
})
6262
```
6363

64+
### Contact us section
65+
66+
Toolkit has the set of default contacts.
67+
If you need to use project-specific contacts, specify items with a following syntax to `contacts` array at `app.config.ts` file of your docs website:
68+
69+
```ts
70+
export default defineAppConfig({
71+
exactproDocs: {
72+
contacts: [
73+
{
74+
contact: '[email protected]',
75+
type: 'email'
76+
},
77+
{
78+
contact: '+4402033191644',
79+
type: 'phone'
80+
}
81+
]
82+
}
83+
})
84+
```
85+
86+
::notice{info}
87+
Default contacts will be hidden if you add any project-specific ones
88+
::
89+
6490
## Configuring a base url
6591

6692
This option might be required when hosting your website on [GitHub Pages](https://pages.github.com/) or [GitLab Pages](https://docs.gitlab.com/ee/user/project/pages/).

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)