Skip to content

Commit c916eb7

Browse files
fix: improve mobile responsiveness across documentation site
Enhanced mobile experience by fixing layout issues and adding comprehensive responsive styles for various screen sizes. Changes: - Fixed horizontal scrolling in Product and UtgMethods components by replacing grid-flow-col with responsive grid layouts that stack on mobile - Added comprehensive mobile breakpoints (@768px, @480px) to custom.css - Implemented responsive typography with scaled font sizes for mobile devices - Optimized navbar, pagination, and footer spacing for touch-friendly interaction - Made community icons and spacing responsive (smaller on mobile, larger on desktop) - Fixed table and code block overflow handling on small screens - Added tablet-specific styles (769px-996px) for mid-range devices - Improved button, card, and form layouts for mobile screens All sections now properly align and display consistently across mobile, tablet, and desktop viewports without horizontal scrolling or broken layouts. Signed-off-by: Divyansh Rai <[email protected]>
1 parent 57ad5e8 commit c916eb7

File tree

5 files changed

+289
-16
lines changed

5 files changed

+289
-16
lines changed

src/components/Community.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const Community = () => {
1010
Are you curious, 🤔 or do you have questions burning in your mind? 🔥
1111
Look no further! Join our lively Community Forum where you can:
1212
</p>
13-
<ul className="grid list-none gap-6 sm:grid-cols-2 xl:gap-8">
13+
<ul className="grid list-none gap-4 sm:grid-cols-2 sm:gap-6 xl:gap-8">
1414
{/*<li>*/}
1515
{/* <a*/}
1616
{/* href="https://community.keploy.io/"*/}
@@ -42,12 +42,12 @@ export const Community = () => {
4242
<li>
4343
<a
4444
href="https://www.youtube.com/channel/UC6OTg7F4o0WkmNtSoob34lg"
45-
className="flex items-start space-x-4"
45+
className="flex items-start space-x-3 sm:space-x-4"
4646
>
4747
<svg
4848
fill="currentColor"
4949
// Hotfix: add viewBox to prevent icon from being cut off after tailwind preflight disabled
50-
className="h-12 w-12 flex-none text-red-500 "
50+
className="h-10 w-10 sm:h-12 sm:w-12 flex-none text-red-500"
5151
viewBox="0 0 48 48"
5252
>
5353
<rect width="48" height="48" rx="12" />
@@ -66,14 +66,14 @@ export const Community = () => {
6666
<li>
6767
<a
6868
href="https://testgpt.substack.com/"
69-
className="flex items-start space-x-4"
69+
className="flex items-start space-x-3 sm:space-x-4"
7070
target="_blank"
7171
rel="noopener noreferrer"
7272
>
7373
<svg
7474
xmlns="http://www.w3.org/2000/svg"
7575
viewBox="0 0 512 512"
76-
className="h-12 w-12 flex-none"
76+
className="h-10 w-10 sm:h-12 sm:w-12 flex-none"
7777
>
7878
<rect width="512" height="512" fill="white" />
7979
<rect x="96" y="128" width="320" height="42.7" fill="#FF6719" />
@@ -94,12 +94,12 @@ export const Community = () => {
9494
<li>
9595
<a
9696
href="https://github.com/keploy"
97-
className="flex items-start space-x-4"
97+
className="flex items-start space-x-3 sm:space-x-4"
9898
>
9999
<svg
100100
fill="currentColor"
101101
// Hotfix: add viewBox to prevent icon from being cut off after tailwind preflight disabled
102-
className="h-12 w-12 flex-none text-black "
102+
className="h-10 w-10 sm:h-12 sm:w-12 flex-none text-black"
103103
viewBox="0 0 48 48"
104104
>
105105
<rect width="48" height="48" rx="12" />
@@ -118,11 +118,11 @@ export const Community = () => {
118118
<li>
119119
<a
120120
href="https://twitter.com/keployio"
121-
className="flex items-start space-x-4"
121+
className="flex items-start space-x-3 sm:space-x-4"
122122
>
123123
<svg
124124
fill="currentColor"
125-
className="h-12 w-12 flex-none text-black"
125+
className="h-10 w-10 sm:h-12 sm:w-12 flex-none text-black"
126126
viewBox="0 0 512 509.64"
127127
>
128128
<rect width="509.64" height="512" rx="120" />
@@ -144,10 +144,10 @@ export const Community = () => {
144144
<li>
145145
<a
146146
href="https://join.slack.com/t/keploy/shared_invite/zt-357qqm9b5-PbZRVu3Yt2rJIa6ofrwWNg"
147-
className="flex items-start space-x-4"
147+
className="flex items-start space-x-3 sm:space-x-4"
148148
>
149149
<svg
150-
className="h-12 w-12 flex-none text-blue-400 "
150+
className="h-10 w-10 sm:h-12 sm:w-12 flex-none text-blue-400"
151151
viewBox="0 0 1610 1610"
152152
>
153153
<title>slack-logo-icon</title>
@@ -205,10 +205,10 @@ export const Community = () => {
205205
<li>
206206
<a
207207
href="https://keploy.io/blog"
208-
className="flex items-start space-x-4"
208+
className="flex items-start space-x-3 sm:space-x-4"
209209
>
210210
<svg
211-
class="h-12 w-12 flex-none "
211+
class="h-10 w-10 sm:h-12 sm:w-12 flex-none"
212212
width="48"
213213
height="48"
214214
viewBox="0 0 48 48"

src/components/Product.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import useBaseUrl from "@docusaurus/useBaseUrl";
55
function UTG() {
66
return (
77
<div className="rounded-lg">
8-
<ul className="grid auto-cols-[300px] grid-flow-col gap-3 lg:gap-5">
8+
<ul className="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 lg:gap-5">
99
<li className="mt-5 flex flex-col space-y-3 text-lg">
1010
<Link
1111
className="text-foreground-light flex-grow text-sm"
@@ -247,7 +247,7 @@ export const Products = () => {
247247
workflow:
248248
</p>
249249

250-
<div className="grid gap-4 sm:grid-cols-3 xl:gap-6">
250+
<div className="grid gap-4 grid-cols-1 sm:grid-cols-3 xl:gap-6">
251251
<UTG />
252252
</div>
253253
</section>

src/components/UtgMethods.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function UTGMethods() {
1313
integration to one-click IDE generation:
1414
</p>
1515

16-
<ul className="grid auto-cols-[300px] grid-flow-col gap-3 lg:gap-5">
16+
<ul className="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 lg:gap-5">
1717
<li className="mt-5 flex flex-col space-y-3 text-lg">
1818
<Link
1919
className="text-foreground-light flex-grow text-sm"

src/css/custom.css

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,4 +873,210 @@ textarea {
873873
background-color: #e67643 !important;
874874
}
875875

876+
/* Mobile Responsive Styles */
877+
@media screen and (max-width: 768px) {
878+
/* Mobile-specific font size adjustments */
879+
:root {
880+
font-size: 16px;
881+
}
882+
883+
/* Ensure proper text wrapping on mobile */
884+
h1 {
885+
font-size: 1.75rem !important;
886+
line-height: 1.2;
887+
word-wrap: break-word;
888+
}
889+
890+
h2 {
891+
font-size: 1.5rem !important;
892+
line-height: 1.3;
893+
word-wrap: break-word;
894+
}
895+
896+
h3 {
897+
font-size: 1.25rem !important;
898+
line-height: 1.4;
899+
}
900+
901+
/* Mobile padding and margin adjustments */
902+
.main {
903+
padding: 0.5rem !important;
904+
}
905+
906+
main {
907+
padding: 1rem !important;
908+
}
909+
910+
/* Improve navbar spacing on mobile */
911+
.navbar__inner {
912+
padding: 0.5rem 1rem !important;
913+
}
914+
915+
.navbar__items--right {
916+
gap: 8px;
917+
}
918+
919+
.navbar__items--right > :last-child {
920+
padding-right: 0;
921+
}
922+
923+
/* Fix sidebar width on mobile */
924+
.docs-wrapper aside {
925+
width: 100% !important;
926+
}
927+
928+
/* Ensure images are responsive */
929+
img {
930+
max-width: 100%;
931+
height: auto;
932+
}
876933

934+
/* Fix table overflow on mobile */
935+
table {
936+
display: block;
937+
overflow-x: auto;
938+
white-space: nowrap;
939+
}
940+
941+
/* Improve code block readability on mobile */
942+
pre {
943+
font-size: 0.85rem;
944+
overflow-x: auto;
945+
}
946+
947+
/* Fix pagination on mobile */
948+
.pagination-nav {
949+
flex-direction: column;
950+
gap: 1rem;
951+
}
952+
953+
.pagination-nav__item {
954+
width: 100%;
955+
}
956+
957+
/* Ensure cards stack properly on mobile */
958+
.card {
959+
margin-bottom: 1rem;
960+
}
961+
962+
/* Fix button sizing on mobile */
963+
.button {
964+
padding: 0.5rem 1rem;
965+
font-size: 0.9rem;
966+
}
967+
968+
/* Improve footer spacing on mobile */
969+
footer {
970+
padding: 1rem;
971+
}
972+
973+
.footer__links {
974+
flex-direction: column;
975+
align-items: flex-start;
976+
}
977+
978+
/* Fix search button on mobile */
979+
.DocSearch-Button {
980+
padding: 0.5rem !important;
981+
font-size: 0.9rem !important;
982+
}
983+
984+
/* Improve TOC on mobile */
985+
.table-of-contents {
986+
padding-top: 1rem;
987+
font-size: 0.9rem;
988+
}
989+
990+
/* Fix announcement bar on mobile */
991+
div[class^="announcementBar_"] {
992+
font-size: 0.85rem;
993+
padding: 0.5rem;
994+
}
995+
996+
/* Ensure prose content is readable on mobile */
997+
.prose {
998+
font-size: 1rem;
999+
}
1000+
1001+
.prose p {
1002+
margin-bottom: 1rem;
1003+
}
1004+
1005+
/* Fix community links spacing on mobile */
1006+
section ul {
1007+
padding-left: 0;
1008+
}
1009+
1010+
section li {
1011+
margin-bottom: 1rem;
1012+
}
1013+
}
1014+
1015+
/* Tablet-specific adjustments */
1016+
@media screen and (min-width: 769px) and (max-width: 996px) {
1017+
:root {
1018+
font-size: 17px;
1019+
}
1020+
1021+
.navbar__inner {
1022+
padding: 0.75rem 2rem;
1023+
}
1024+
1025+
main {
1026+
padding: 1.5rem !important;
1027+
}
1028+
1029+
h1 {
1030+
font-size: 2rem;
1031+
}
1032+
1033+
h2 {
1034+
font-size: 1.75rem;
1035+
}
1036+
}
1037+
1038+
/* Small mobile devices */
1039+
@media screen and (max-width: 480px) {
1040+
:root {
1041+
font-size: 14px;
1042+
}
1043+
1044+
h1 {
1045+
font-size: 1.5rem !important;
1046+
}
1047+
1048+
h2 {
1049+
font-size: 1.25rem !important;
1050+
}
1051+
1052+
h3 {
1053+
font-size: 1.1rem !important;
1054+
}
1055+
1056+
/* Tighter spacing for small screens */
1057+
main {
1058+
padding: 0.75rem !important;
1059+
}
1060+
1061+
.navbar__inner {
1062+
padding: 0.5rem !important;
1063+
}
1064+
1065+
/* Smaller buttons on small screens */
1066+
.button {
1067+
padding: 0.4rem 0.8rem;
1068+
font-size: 0.85rem;
1069+
}
1070+
1071+
/* Adjust card padding on small screens */
1072+
.card,
1073+
div[class*="rounded-lg"] {
1074+
padding: 0.75rem !important;
1075+
}
1076+
1077+
/* Fix icon sizing on small screens */
1078+
svg {
1079+
max-width: 100%;
1080+
height: auto;
1081+
}
1082+
}

0 commit comments

Comments
 (0)