-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeedback.py
More file actions
112 lines (94 loc) · 3.34 KB
/
feedback.py
File metadata and controls
112 lines (94 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import streamlit as st
import pandas as pd
def main():
# Set the page layout and background color
# Background color styling
st.markdown(
"""
<style>
.stApp {
background-color: #000000;
}
.slider-container {
display: flex;
align-items: center;
justify-content: center;
}
.slider-labels {
display: flex;
justify-content: space-between;
width: 100%;
margin: 0 20px;
font-size: 1.2rem;
}
.star {
font-size: 2rem;
color: #ffd700;
}
</style>
""",
unsafe_allow_html=True
)
# Title with emoji
st.title("💬 Feedback")
# Subtitle with color
st.markdown(
"<h3 style='color: #ff6347;'>We'd love to hear from you!</h3>",
unsafe_allow_html=True
)
# Instructions with color
st.markdown(
"<p style='color: #4682b4;'>Please fill out the form below to provide your valuable feedback or reach out to us through the provided contact details.</p>",
unsafe_allow_html=True
)
# Text input for Name
name = st.text_input("👤 Your Name", "")
# Text input for Email
email = st.text_input("✉️ Your Email", "")
# Text area for Feedback
feedback = st.text_area("📝 Your Feedback", "")
# Real-time Feedback Character Count
feedback_length = len(feedback)
st.markdown(f"Character count: **{feedback_length}**")
# Modern Rating System using Select Slider
st.markdown("<h4 style='color: #4682b4;'>⭐ Rate your experience</h4>", unsafe_allow_html=True)
star_labels = [f"{i}⭐" for i in range(1, 6)]
# Create a select slider with star labels
rating = st.select_slider(
"",
options=star_labels,
value="3⭐",
format_func=lambda x: x
)
# Extract numerical rating from selected label
numeric_rating = int(rating.replace("⭐", "").strip())
# Checkbox for Consent
consent = st.checkbox("I agree to the terms and conditions")
# Button to submit the form
if st.button("Send Feedback"):
if name and email and feedback and consent:
st.success(f"Thank you, {name}! Your feedback has been received. 🎉")
# Simulate saving feedback data
feedback_data = {
"Name": [name],
"Email": [email],
"Feedback": [feedback],
"Rating": [numeric_rating]
}
df = pd.DataFrame(feedback_data)
st.write("Here's a preview of your feedback:")
st.dataframe(df)
else:
st.error("Please fill out all fields and agree to the terms before submitting. 🚫")
# Contact details section
st.markdown("---")
st.markdown(
"<h4 style='color: #32cd32;'>📞 Contact Us</h4>",
unsafe_allow_html=True
)
st.markdown(
"<p style='color: #6a5acd;'>Email: <a href='mailto:devanik2005@gmail.com'>devanik2005@gmail.com</a><br>LinkedIn: <a href='https://www.linkedin.com/in/devanik/' target='_blank'>Devanik</a></p>",
unsafe_allow_html=True
)
if __name__ == "__main__":
main()