Skip to content

Commit c80c3e4

Browse files
authored
Merge branch 'master' into os
2 parents 3458f93 + f70179c commit c80c3e4

File tree

4 files changed

+1112
-274
lines changed

4 files changed

+1112
-274
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
## Components: CodeWithCopy
2+
3+
**Description**:
4+
- Adds copy button to a code.
5+
- Suitable for both single/multiple lines in a *code-block*
6+
7+
**Known issues**:
8+
- Doesn't look nice on long code-lines, copy button overlays code. It's better to break such lines to several.
9+
10+
**Usage example**:
11+
12+
<CodeWithCopy>
13+
14+
```text
15+
CODE
16+
```
17+
18+
</CodeWithCopy>
19+
20+
## Components: CodeTabs
21+
22+
**Description**:
23+
24+
- Designed to combine code, for example, one-purpose commands for different Linux systems.
25+
- Has a built-in copy button and scroll.
26+
27+
**Usage example**:
28+
29+
- Single line
30+
31+
<CodeTabs :tabs="[
32+
{ title: 'Option-1', content: `CODE` },
33+
{ title: 'Option-2', content: `CODE` }
34+
]" />
35+
36+
- Multiple lines
37+
38+
<CodeTabs :tabs="[
39+
{ title: 'Option-1', content:
40+
`CODE
41+
CODE
42+
CODE` },
43+
{ title: 'Option-2', content:
44+
`CODE
45+
CODE
46+
CODE` }
47+
]" />
48+
49+
## Components: TableTabs
50+
51+
**Description**:
52+
53+
- Designed to combine content (version-tables, text informtation, etc).
54+
- Lines help distinguish interactive content beginning and finish.
55+
- Has a drop-down selector to choose what content to show.
56+
- Each option in selector has a anchor to be able to get an individual link and send it to another person who will see the respective content when clicking the link.
57+
- A `label` can be added before selector as an option intro-phrase like *Choose version*.
58+
- Dropdown item names are written in respective templates as `#XX_YY_ZZ`, when rendering `_` will be replaced with space ` `.
59+
60+
**Known issues**:
61+
62+
- Headings *inside* a selector option loose their linkability so instead better to proived to another person a link to the entire option.
63+
64+
**Usage example**:
65+
66+
<TableTabs label="Choose an extension: " >
67+
68+
<template #Extension_1>
69+
70+
Any your content.
71+
72+
</template>
73+
74+
<template #Extension_2>
75+
76+
Any your content.
77+
78+
</template>
79+
80+
</TableTabs>
Lines changed: 80 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,100 @@
11
<script setup>
2-
import { ref, computed, useSlots } from 'vue'
2+
import { ref, computed, useSlots, onMounted, watch, nextTick } from 'vue'
33
44
const slots = useSlots()
55
const tabKeys = Object.keys(slots)
66
const activeTab = ref(tabKeys[0] ?? '')
77
const currentTab = computed(() => activeTab.value)
8+
const wrapperRef = ref(null)
9+
10+
function formatKey(key) {
11+
return key.replace(/[__]/g, ' ')
12+
}
13+
14+
defineProps({
15+
label: {
16+
type: String,
17+
default: ''
18+
}
19+
})
20+
21+
onMounted(() => {
22+
const hash = decodeURIComponent(window.location.hash.slice(1))
23+
if (tabKeys.includes(hash)) {
24+
activeTab.value = hash
25+
nextTick(() => {
26+
const el = wrapperRef.value
27+
if (el) {
28+
const offset = 80
29+
const top = el.getBoundingClientRect().top + window.scrollY - offset
30+
window.scrollTo({ top, behavior: 'smooth' })
31+
}
32+
})
33+
}
34+
})
35+
36+
watch(activeTab, (newVal) => {
37+
if (newVal) {
38+
history.replaceState(null, '', `#${encodeURIComponent(newVal)}`)
39+
}
40+
})
841
</script>
942
1043
<template>
11-
<div class="table-tabs mt-8 border rounded-lg overflow-hidden text-sm">
12-
<div class="bg-gray-50 flex justify-between items-center border-b">
13-
<!-- <span class="font-medium text-gray-700">Optional Text:span> -->
14-
<select
15-
v-model="activeTab"
16-
class="bg-white text-gray-800 text-sm rounded border-gray-300 focus:outline-none focus:ring-1 focus:ring-blue-500"
17-
>
44+
<div ref="wrapperRef" class="table-tabs" :id="activeTab">
45+
<div class="tab-header">
46+
<span v-if="label" class="label-text">
47+
{{ label }}
48+
</span>
49+
<select v-model="activeTab" class="tab-select">
1850
<option v-for="key in tabKeys" :key="key" :value="key">
19-
{{ key }}
51+
{{ formatKey(key) }}
2052
</option>
2153
</select>
2254
</div>
2355
24-
<div class="tab-content prose prose-sm max-w-none">
56+
<div class="tab-content">
2557
<slot :name="currentTab" />
2658
</div>
59+
60+
<div class="bottom-line" />
2761
</div>
2862
</template>
2963
3064
65+
<style scoped>
66+
.table-tabs {
67+
background: #fff;
68+
scroll-margin-top: 4rem;
69+
}
70+
71+
.tab-header {
72+
border-top: 1px solid #d1d5db;
73+
padding: 1rem 0;
74+
}
75+
76+
.label-text {
77+
color: #314659;
78+
}
79+
80+
.tab-select {
81+
background-color: #fff;
82+
color: #314659;
83+
font-size: 0.9rem;
84+
padding: 0.25rem 0.25rem;
85+
border: 1px solid #d1d5db;
86+
border-radius: 0.5rem;
87+
outline: none;
88+
}
89+
90+
.tab-select:focus {
91+
border-color: #5897fb;
92+
box-shadow: 0 0 0 1px #5897fb;
93+
}
94+
95+
.bottom-line {
96+
border-top: 1px solid #d1d5db;
97+
margin-top: 1rem;
98+
}
99+
</style>
100+

docs/.vuepress/routes.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,16 @@
3030
"/els-for-languages/php/#download-tuxcare-php-windows": "/els-for-languages/php/#download-and-install-tuxcare-php-windows",
3131
"/els-for-languages/php/#configure-php": "/els-for-languages/php/#download-and-install-tuxcare-php-windows",
3232
"/els-for-languages/php/#add-php-to-the-system-path": "/els-for-languages/php/#download-and-install-tuxcare-php-windows",
33-
"/els-for-os/#cloudlinux-6-els": "/els-for-os/"
33+
"/els-for-os/#cloudlinux-6-els": "/els-for-os/",
34+
"/els-for-languages/php/#additional-configurations-optional": "/els-for-languages/php/#Enabling_a_module",
35+
"/els-for-languages/php/#enabling-a-module-through-default-ini": "/els-for-languages/php/#Enabling_a_module",
36+
"/els-for-languages/php/#enabling-a-module-through-the-configuration-files": "/els-for-languages/php/#Enabling_a_module",
37+
"/els-for-languages/php/#enabling-a-module-through-the-cli": "/els-for-languages/php/#Enabling_a_module",
38+
"/els-for-languages/php/#listing-enabled-modules-on-a-specific-version": "/els-for-languages/php/#Listing_enabled_modules_on_a_specific_version",
39+
"/els-for-languages/php/#location-of-default-ini": "/els-for-languages/php/#Location_of_default.ini",
40+
"/els-for-languages/php/#location-of-ini-config-files": "/els-for-languages/php/#Location_of_ini_config_files",
41+
"/els-for-languages/php/#running-code-on-a-specific-version-through-the-cli": "/els-for-languages/php/#Running_code_on_a_specific_version_through_the_CLI",
42+
"/els-for-languages/php/#modules-and-pecl-extensions": "/els-for-languages/php/#Modules_and_pecl_extensions",
43+
"/els-for-languages/php/#the-bin-files": "/els-for-languages/php/#The_bin_files",
44+
"/els-for-languages/php/#how-to-use-php-els": "/els-for-languages/php/#Increase_upload_or_memory_limits"
3445
}

0 commit comments

Comments
 (0)