Skip to content

Commit cc6294d

Browse files
authored
Merge pull request #153 from AddSearch/sc-12487/change-size-of-toggle-button-in-ai-answers
feat: [sc-12487] Changing the size of the toggle button in AI Answers
2 parents ac98fb0 + c9221df commit cc6294d

File tree

4 files changed

+82
-23
lines changed

4 files changed

+82
-23
lines changed

examples/aianswers/index.html

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>AddSearch Search UI: AI Answers Result</title>
5+
<meta name="viewport" content="width=device-width,initial-scale=1">
6+
<meta charset="UTF-8">
7+
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700&display=swap" rel="stylesheet">
8+
<script src="https://cdn.jsdelivr.net/npm/addsearch-js-client@1.1/dist/addsearch-js-client.min.js"
9+
integrity="sha384-bMenmxFJb5gJmf+h89NT/Ai405PPITc8yqHYIlW7kqRYta/ZBwVjx5C67BC88njD"
10+
crossorigin="anonymous"></script>
11+
<script src="../../dist/addsearch-search-ui.min.js"></script>
12+
<link rel="stylesheet" href="../../dist/addsearch-search-ui.min.css" />
13+
14+
<style type="text/css">
15+
body {
16+
font-family: 'Lato', sans-serif;
17+
min-width: 320px;
18+
}
19+
</style>
20+
</head>
21+
<body>
22+
23+
<!-- Containers. Search UI components will be added inside these divs -->
24+
<div id="searchfield"></div>
25+
<div id="ai-answers-result-container"></div>
26+
27+
<script>
28+
// AddSearch JS client with an example index. Get your own SITEKEY by signing up at www.addsearch.com
29+
var client = new AddSearchClient('490c606d6377e1876fa7fecb5f7e6420');
30+
var config = {
31+
hasAiAnswers: true,
32+
}
33+
34+
// Search UI instance
35+
var searchui = new AddSearchUI(client, config);
36+
37+
// Add components
38+
searchui.searchField({
39+
containerId: 'searchfield',
40+
placeholder: 'Keyword..',
41+
button: 'Search',
42+
searchAsYouType: false
43+
});
44+
45+
searchui.aiAnswersResult({
46+
containerId: 'ai-answers-result-container',
47+
mainHeadlineText: 'AI-generated answer',
48+
answerMaxHeight: 150,
49+
sourcesHeadlineText: 'Based on the following sources:',
50+
hasHideToggle: true
51+
});
52+
53+
54+
// All components added. Start
55+
searchui.start();
56+
</script>
57+
58+
</body>
59+
</html>

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "addsearch-search-ui",
3-
"version": "0.9.8",
3+
"version": "0.9.9",
44
"description": "JavaScript library to develop Search UIs for the web",
55
"repository": {
66
"type": "git",

src/components/aianswersresult/aianswersresult.scss

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
.header-right-hand-side-container {
7575
display: flex;
7676
align-items: center;
77-
gap: 16px;
77+
gap: 10px;
7878
}
7979

8080
.ai-explanation-text {
@@ -111,8 +111,8 @@
111111
.toggle-switch {
112112
position: relative;
113113
display: inline-block;
114-
width: 60px;
115-
height: 34px;
114+
width: 30px;
115+
height: 17px;
116116

117117
input {
118118
opacity: 0;
@@ -128,7 +128,7 @@
128128
}
129129

130130
&:checked + .slider:before {
131-
transform: translateX(26px);
131+
transform: translateX(12px);
132132
}
133133
}
134134

@@ -145,10 +145,10 @@
145145
&:before {
146146
position: absolute;
147147
content: '';
148-
height: 26px;
149-
width: 26px;
150-
left: 4px;
151-
bottom: 4px;
148+
height: 13px;
149+
width: 13px;
150+
left: 3px;
151+
bottom: 2px;
152152
background-color: white;
153153
transition: 0.4s;
154154
}

0 commit comments

Comments
 (0)