Files
qiming/qiming-vite-plugin-design-mode/examples/react-tsx/src/App.css
2026-06-01 13:43:09 +08:00

474 lines
8.1 KiB
CSS

/* 全局样式重置 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
}
.App {
min-height: 100vh;
color: #333;
}
/* 头部样式 */
.main-header {
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
padding: 1rem 2rem;
box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
position: sticky;
top: 0;
z-index: 100;
}
.main-header .title {
font-size: 1.5rem;
font-weight: 700;
color: #4a5568;
margin-bottom: 0.5rem;
}
.navigation .nav-list {
display: flex;
list-style: none;
gap: 2rem;
}
.nav-link {
text-decoration: none;
color: #4a5568;
font-weight: 500;
transition: color 0.3s ease;
}
.nav-link:hover {
color: #667eea;
}
/* 主要内容区域 */
.main-content {
padding: 2rem;
max-width: 1200px;
margin: 0 auto;
}
/* 英雄区域 */
.hero-section {
text-align: center;
padding: 4rem 0;
margin-bottom: 3rem;
}
.hero-content {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(20px);
border-radius: 20px;
padding: 3rem;
border: 1px solid rgba(255, 255, 255, 0.2);
}
.hero-title {
font-size: 3rem;
font-weight: 800;
color: white;
margin-bottom: 1.5rem;
text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}
.hero-description {
font-size: 1.2rem;
color: rgba(255, 255, 255, 0.9);
margin-bottom: 2rem;
line-height: 1.6;
}
.hero-buttons {
display: flex;
gap: 1rem;
justify-content: center;
flex-wrap: wrap;
}
.hero-btn {
padding: 0.75rem 2rem;
border: none;
border-radius: 50px;
font-weight: 600;
font-size: 1rem;
cursor: pointer;
transition: all 0.3s ease;
text-decoration: none;
display: inline-block;
}
.hero-btn.primary {
background: linear-gradient(45deg, #ff6b6b, #ee5a24);
color: white;
box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}
.hero-btn.secondary {
background: rgba(255, 255, 255, 0.2);
color: white;
border: 2px solid rgba(255, 255, 255, 0.3);
}
.hero-btn:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}
/* 计数器组件 */
.counter-container {
background: white;
border-radius: 15px;
padding: 2rem;
margin: 2rem 0;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
text-align: center;
}
.counter-container h2 {
margin-bottom: 1.5rem;
color: #4a5568;
}
.counter-display {
font-size: 2rem;
font-weight: 700;
color: #667eea;
margin-bottom: 2rem;
padding: 1rem;
background: #f7fafc;
border-radius: 10px;
}
.counter-buttons {
display: flex;
gap: 1rem;
justify-content: center;
flex-wrap: wrap;
}
.counter-btn {
padding: 0.75rem 1.5rem;
border: none;
border-radius: 10px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
min-width: 80px;
}
.counter-btn.increment {
background: linear-gradient(45deg, #48bb78, #38a169);
color: white;
}
.counter-btn.decrement {
background: linear-gradient(45deg, #f56565, #e53e3e);
color: white;
}
.counter-btn.reset {
background: linear-gradient(45deg, #a0aec0, #718096);
color: white;
}
.counter-btn:hover {
transform: translateY(-2px);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
/* 特性区域 */
.features-section {
margin: 3rem 0;
}
.section-title {
text-align: center;
font-size: 2.5rem;
font-weight: 700;
color: white;
margin-bottom: 3rem;
text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.features-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
padding: 0 1rem;
}
.feature-card {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(20px);
border-radius: 15px;
padding: 2rem;
text-align: center;
border: 1px solid rgba(255, 255, 255, 0.2);
transition: all 0.3s ease;
}
.feature-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
background: rgba(255, 255, 255, 0.15);
}
.feature-icon {
font-size: 3rem;
margin-bottom: 1rem;
}
.feature-title {
font-size: 1.5rem;
font-weight: 600;
color: white;
margin-bottom: 1rem;
}
.feature-description {
color: rgba(255, 255, 255, 0.9);
line-height: 1.6;
}
/* 动态内容区域 */
.dynamic-section {
background: white;
border-radius: 15px;
padding: 2rem;
margin: 2rem 0;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}
.dynamic-controls {
display: flex;
gap: 1rem;
margin-bottom: 2rem;
flex-wrap: wrap;
}
.toggle-btn, .add-item-btn {
padding: 0.75rem 1.5rem;
border: none;
border-radius: 10px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
}
.toggle-btn {
background: linear-gradient(45deg, #667eea, #764ba2);
color: white;
}
.add-item-btn {
background: linear-gradient(45deg, #48bb78, #38a169);
color: white;
}
.dynamic-content {
animation: fadeIn 0.3s ease-in;
}
.items-list {
list-style: none;
}
.list-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.75rem 1rem;
margin-bottom: 0.5rem;
background: #f7fafc;
border-radius: 8px;
border-left: 4px solid #667eea;
}
.item-text {
font-weight: 500;
}
.remove-btn {
background: #f56565;
color: white;
border: none;
border-radius: 50%;
width: 24px;
height: 24px;
cursor: pointer;
font-weight: bold;
transition: all 0.3s ease;
}
.remove-btn:hover {
background: #e53e3e;
transform: scale(1.1);
}
/* 表单区域 */
.form-section {
background: white;
border-radius: 15px;
padding: 2rem;
margin: 2rem 0;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}
.contact-form {
max-width: 500px;
margin: 0 auto;
}
.form-group {
margin-bottom: 1.5rem;
}
.form-label {
display: block;
margin-bottom: 0.5rem;
font-weight: 600;
color: #4a5568;
}
.form-input, .form-textarea {
width: 100%;
padding: 0.75rem;
border: 2px solid #e2e8f0;
border-radius: 8px;
font-size: 1rem;
transition: border-color 0.3s ease;
font-family: inherit;
}
.form-input:focus, .form-textarea:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.form-textarea {
resize: vertical;
min-height: 100px;
}
.submit-btn {
width: 100%;
padding: 0.75rem;
background: linear-gradient(45deg, #667eea, #764ba2);
color: white;
border: none;
border-radius: 8px;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
}
.submit-btn:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}
/* 页脚 */
.main-footer {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(20px);
text-align: center;
padding: 2rem;
color: white;
border-top: 1px solid rgba(255, 255, 255, 0.2);
}
/* 动画 */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* 响应式设计 */
@media (max-width: 768px) {
.main-content {
padding: 1rem;
}
.hero-title {
font-size: 2rem;
}
.hero-content {
padding: 2rem 1rem;
}
.hero-buttons {
flex-direction: column;
align-items: center;
}
.hero-btn {
width: 200px;
}
.features-grid {
grid-template-columns: 1fr;
gap: 1rem;
}
.counter-buttons {
flex-direction: column;
align-items: center;
}
.dynamic-controls {
flex-direction: column;
}
.navigation .nav-list {
flex-direction: column;
gap: 0.5rem;
}
}
/* 设计模式高亮样式(当启用设计模式时显示) */
[data-source-info]:hover {
outline: 2px dashed #667eea !important;
outline-offset: 2px !important;
cursor: pointer !important;
position: relative !important;
}
[data-source-info]:hover::after {
content: attr(data-source-info);
position: absolute;
bottom: 100%;
left: 0;
background: #333;
color: white;
padding: 0.5rem;
border-radius: 4px;
font-size: 0.8rem;
white-space: nowrap;
z-index: 1000;
opacity: 0;
animation: fadeIn 0.3s ease-in forwards;
}