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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Here created a Google - Clone design using Streamlit
|
| 2 |
+
# In streamlit you can use html and css
|
| 3 |
+
|
| 4 |
+
import streamlit as st
|
| 5 |
+
|
| 6 |
+
def main():
|
| 7 |
+
# Styling using Streamlit markdown
|
| 8 |
+
st.markdown(
|
| 9 |
+
"""
|
| 10 |
+
<style>
|
| 11 |
+
html {
|
| 12 |
+
height: 100%;
|
| 13 |
+
font-size: 100%;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
body {
|
| 17 |
+
font: 13px arial, sans-serif;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
nav {
|
| 23 |
+
display: flex;
|
| 24 |
+
justify-content: flex-end;
|
| 25 |
+
align-items: center;
|
| 26 |
+
padding: 10px;
|
| 27 |
+
background-color: #ffffff;
|
| 28 |
+
float: right;
|
| 29 |
+
margin-right: -44%;
|
| 30 |
+
margin-top: -12%;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
.right_nav {
|
| 34 |
+
list-style: none;
|
| 35 |
+
display: flex;
|
| 36 |
+
align-items: center;
|
| 37 |
+
gap: 20px;
|
| 38 |
+
margin: 3rem;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
.apps {
|
| 42 |
+
width: 16px;
|
| 43 |
+
height: 16px;
|
| 44 |
+
opacity: 0.75;
|
| 45 |
+
transition: opacity 0.2s;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
.apps:hover {
|
| 49 |
+
opacity: 1;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
.sign_in {
|
| 53 |
+
height: 60%;
|
| 54 |
+
background: #4285f4;
|
| 55 |
+
width: 86px;
|
| 56 |
+
height: 35px;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
.sign_in a {
|
| 60 |
+
font-weight: bold;
|
| 61 |
+
color: #fff;
|
| 62 |
+
text-decoration: none;
|
| 63 |
+
padding-left: 10%;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
.sign_in a:hover {
|
| 67 |
+
text-decoration: none;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
.cntr_pg {
|
| 71 |
+
position: absolute;
|
| 72 |
+
top: 40%;
|
| 73 |
+
left: 50%;
|
| 74 |
+
margin-right: -40%;
|
| 75 |
+
transform: translate(-50%, -50%);
|
| 76 |
+
margin: 3rem;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
.logo {
|
| 80 |
+
display: block;
|
| 81 |
+
margin: auto;
|
| 82 |
+
height: 92px;
|
| 83 |
+
width: 272px;
|
| 84 |
+
margin-top:40%;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
.search_bar {
|
| 88 |
+
border-radius: 40px;
|
| 89 |
+
width: 585px;
|
| 90 |
+
margin: auto;
|
| 91 |
+
height: 39px;
|
| 92 |
+
border: .7px solid #E4E4E4;
|
| 93 |
+
background-color: #fff;
|
| 94 |
+
box-shadow: 0px 1px 4px #E4E4E4;
|
| 95 |
+
margin-bottom: 20px;
|
| 96 |
+
outline: none;
|
| 97 |
+
text-indent: 15px;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
.search_bar:hover, .search_bar:active {
|
| 101 |
+
padding-bottom: 2px;
|
| 102 |
+
padding-top: 1px;
|
| 103 |
+
margin-top: -1px;
|
| 104 |
+
width: 585px;
|
| 105 |
+
box-shadow: 0px 3px 8px #E4E4E4;
|
| 106 |
+
outline: none;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
.mic {
|
| 110 |
+
width: 14px;
|
| 111 |
+
height: 20px;
|
| 112 |
+
position: relative;
|
| 113 |
+
left: 555px;
|
| 114 |
+
top: 34px;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
.submit_buttons {
|
| 118 |
+
display: inline-block;
|
| 119 |
+
height: 36px;
|
| 120 |
+
cursor: pointer;
|
| 121 |
+
line-height: 27px;
|
| 122 |
+
background-color: #f2f2f2;
|
| 123 |
+
border: 1px solid #f2f2f2;
|
| 124 |
+
border-radius: 2px;
|
| 125 |
+
color: #757575;
|
| 126 |
+
cursor: default;
|
| 127 |
+
font-family: arial, sans-serif;
|
| 128 |
+
font-size: 13px;
|
| 129 |
+
font-weight: bold;
|
| 130 |
+
margin: 11px 4px;
|
| 131 |
+
min-width: 54px;
|
| 132 |
+
padding: 0 16px;
|
| 133 |
+
text-align: center;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
.submit_buttons {
|
| 137 |
+
position: relative;
|
| 138 |
+
left: 25%;
|
| 139 |
+
right: -50%;
|
| 140 |
+
cursor: pointer;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
.submit_buttons:hover {
|
| 144 |
+
border: .7px solid #d0d0d0;
|
| 145 |
+
color: #000;
|
| 146 |
+
box-shadow: 0px 1px 4px #E4E4E4;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
</style>
|
| 151 |
+
""",
|
| 152 |
+
unsafe_allow_html=True
|
| 153 |
+
)
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
# Navigation (navbar)
|
| 158 |
+
st.markdown(
|
| 159 |
+
"""
|
| 160 |
+
<nav>
|
| 161 |
+
<ul class="right_nav">
|
| 162 |
+
<li><a href="#" style="color: black;">Gmail</a></li>
|
| 163 |
+
<li><a href="#" style="color: black;">Images</a></li>
|
| 164 |
+
<li><a href="#"><img class="apps" src="https://thumb.ibb.co/gykLCw/grid_menu.png"></a></li>
|
| 165 |
+
<li class="sign_in" style="padding: 2%; margin-left: 2%"><a href="#">Sign in</a></li>
|
| 166 |
+
</ul>
|
| 167 |
+
</nav>
|
| 168 |
+
""",
|
| 169 |
+
unsafe_allow_html=True
|
| 170 |
+
)
|
| 171 |
+
|
| 172 |
+
# Center content
|
| 173 |
+
st.markdown(
|
| 174 |
+
"""
|
| 175 |
+
<section class="cntr_pg">
|
| 176 |
+
<img class="logo" src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" alt="Google logo" />
|
| 177 |
+
<img class="mic" src="https://upload.wikimedia.org/wikipedia/commons/2/22/Google_microphone_logo.png" alt="" />
|
| 178 |
+
<form action="#" method="#" name="searchquery" class="form">
|
| 179 |
+
<input type="text" name="searchfield" class="search_bar">
|
| 180 |
+
<div class="search_buttons">
|
| 181 |
+
<input class="submit_buttons" type="submit" value="Google Search" name="submit">
|
| 182 |
+
<input class="submit_buttons" type="submit" value="I'm Feeling Lucky" name="feelinglucky">
|
| 183 |
+
</div>
|
| 184 |
+
</form>
|
| 185 |
+
</section>
|
| 186 |
+
""",
|
| 187 |
+
unsafe_allow_html=True
|
| 188 |
+
)
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
if __name__ == "__main__":
|
| 193 |
+
main()
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
streamlit==1.23.1
|