Skip to content

Commit 7e384ef

Browse files
committed
docs: add algolia search
1 parent cd67330 commit 7e384ef

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

examples/sites/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,24 @@
2121
window.DEPLOY_URL = ''
2222
window.process = { env: {} }
2323
</script>
24+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@3"/>
2425
</head>
2526

2627
<body class="of-hidden">
2728
<div id="header"></div>
2829
<app-root></app-root>
2930
<div id="app" class="wp100 hp100 pt60 of-hidden"></div>
31+
<div class="search-box"></div>
32+
<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script>
33+
<script type="text/javascript">
34+
docsearch({
35+
appId: "AGPA5UXHMH",
36+
apiKey: "5fa09fc20270efa61d68e2c2eb0f56df",
37+
indexName: "opentiny",
38+
container: ".search-box",
39+
debug: false
40+
});
41+
</script>
3042
<!-- prettier-ignore -->
3143
<script id="tinyui-design-common" src="/static/js/design-common.js"></script>
3244
<script type="module" src="./src/main.js"></script>

examples/sites/src/style.css

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,57 @@ b, strong {
2525
.tiny-grid td,.tiny-grid th {
2626
vertical-align: middle;
2727
}
28+
29+
/* Algolia 搜索 */
30+
31+
.search-box {
32+
position: absolute;
33+
z-index: 1000;
34+
top: 12px;
35+
left: 360px;
36+
}
37+
38+
.DocSearch-Button {
39+
border-radius: 6px;
40+
transition: 0.4s
41+
}
42+
43+
.DocSearch-Button:hover {
44+
box-shadow: inset 0 0 0 1px #1476ff;
45+
background-color: #f5f5f5;
46+
}
47+
48+
.DocSearch-Button .DocSearch-Search-Icon {
49+
width: 14px;
50+
}
51+
52+
.DocSearch-Button-Placeholder {
53+
color: #969faf;
54+
}
55+
56+
:root {
57+
--docsearch-primary-color: #1476ff;
58+
--docsearch-searchbox-background: #f5f5f5;
59+
}
60+
61+
@media screen and (max-width: 1023px) {
62+
.search-box {
63+
left: 420px;
64+
}
65+
}
66+
67+
@media screen and (max-width: 768px) {
68+
.DocSearch-Modal {
69+
margin-top: 60px;
70+
}
71+
72+
.search-box {
73+
left: 360px;
74+
}
75+
}
76+
77+
@media screen and (max-width: 430px) {
78+
.search-box {
79+
left: 300px;
80+
}
81+
}

examples/sites/src/views/layout/layout.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
:data="menuOptions"
1212
:menu-collapsible="true"
1313
:filter-node-method="searchMenu"
14+
:show-filter="false"
1415
@current-change="clickMenu"
1516
@collapse-change="collapseChange"
1617
>

0 commit comments

Comments
 (0)