Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ai-box
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
青山
ai-box
Commits
6b538bc4
Commit
6b538bc4
authored
Sep 11, 2024
by
fisherdaddy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update style
parent
5990b99e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
130 additions
and
66 deletions
+130
-66
Footer.jsx
src/components/Footer.jsx
+1
-1
Header.jsx
src/components/Header.jsx
+1
-1
TextToImage.jsx
src/components/TextToImage.jsx
+69
-31
i18n.js
src/js/i18n.js
+1
-3
Header.css
src/styles/Header.css
+58
-30
No files found.
src/components/Footer.jsx
View file @
6b538bc4
...
@@ -3,7 +3,7 @@ import React from 'react';
...
@@ -3,7 +3,7 @@ import React from 'react';
function
Footer
()
{
function
Footer
()
{
return
(
return
(
<
footer
>
<
footer
>
<
p
>
©
2024 AI工具箱. 保留所有权利。
</
p
>
<
p
>
©
2024 AI
工具箱. 保留所有权利。
</
p
>
</
footer
>
</
footer
>
);
);
}
}
...
...
src/components/Header.jsx
View file @
6b538bc4
...
@@ -13,8 +13,8 @@ function Header() {
...
@@ -13,8 +13,8 @@ function Header() {
<
header
>
<
header
>
<
nav
>
<
nav
>
<
div
className=
"logo-title-container"
>
<
div
className=
"logo-title-container"
>
<
img
src=
{
logo
}
alt=
"Logo"
className=
"logo"
/>
<
Link
to=
"/"
className=
"title no-underline"
>
<
Link
to=
"/"
className=
"title no-underline"
>
<
img
src=
{
logo
}
alt=
"Logo"
className=
"logo"
/>
{
t
(
'title'
)
}
{
t
(
'title'
)
}
</
Link
>
</
Link
>
</
div
>
</
div
>
...
...
src/components/TextToImage.jsx
View file @
6b538bc4
import
React
,
{
useState
,
useRef
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useRef
,
useEffect
}
from
'react'
;
import
styled
from
'styled-components'
;
import
styled
from
'styled-components'
;
const
Wrapper
=
styled
.
div
`
width: 100%;
max-width: 1000px;
margin: 10px auto;
`
;
const
Title
=
styled
.
h1
`
font-size: 20px;
color: #333;
margin-bottom: 10px;
text-align: center;
`
;
const
Container
=
styled
.
div
`
const
Container
=
styled
.
div
`
display: flex;
display: flex;
flex-direction: column;
width: 100%;
width: 100%;
max-width: 1200px;
height: 80vh;
background-color: white;
background-color: white;
border-radius: 1
5
px;
border-radius: 1
0
px;
box-shadow: 0
4px 6
px rgba(0, 0, 0, 0.1);
box-shadow: 0
2px 4
px rgba(0, 0, 0, 0.1);
overflow: hidden;
overflow: hidden;
margin: 20px auto;
margin: 10px auto;
@media (min-width: 768px) {
flex-direction: row;
height: 70vh;
}
`
;
`
;
const
InputText
=
styled
.
textarea
`
const
InputText
=
styled
.
textarea
`
width:
5
0%;
width:
10
0%;
height:
100%
;
height:
200px
;
font-size: 1
6
px;
font-size: 1
4
px;
padding:
2
0px;
padding:
1
0px;
border: none;
border: none;
border-
right
: 1px solid #e0e0e0;
border-
bottom
: 1px solid #e0e0e0;
box-sizing: border-box;
box-sizing: border-box;
outline: none;
outline: none;
resize: none;
resize: none;
@media (min-width: 768px) {
width: 50%;
height: 100%;
border-bottom: none;
border-right: 1px solid #e0e0e0;
}
`
;
`
;
const
PreviewContainer
=
styled
.
div
`
const
PreviewContainer
=
styled
.
div
`
width: 50%;
width: 100%;
height: 100%;
display: flex;
display: flex;
flex-direction: column;
flex-direction: column;
justify-content: space-between;
justify-content: space-between;
padding:
2
0px;
padding:
1
0px;
box-sizing: border-box;
box-sizing: border-box;
@media (min-width: 768px) {
width: 50%;
height: 100%;
}
`
;
`
;
const
Preview
=
styled
.
div
`
const
Preview
=
styled
.
div
`
...
@@ -43,6 +71,12 @@ const Preview = styled.div`
...
@@ -43,6 +71,12 @@ const Preview = styled.div`
overflow-y: auto;
overflow-y: auto;
flex-grow: 1;
flex-grow: 1;
padding-right: 10px;
padding-right: 10px;
font-size: 14px;
max-height: 200px;
@media (min-width: 768px) {
max-height: none;
}
h1, h2, h3 {
h1, h2, h3 {
color: #2c3e50;
color: #2c3e50;
...
@@ -50,7 +84,7 @@ const Preview = styled.div`
...
@@ -50,7 +84,7 @@ const Preview = styled.div`
}
}
&::-webkit-scrollbar {
&::-webkit-scrollbar {
width:
8
px;
width:
6
px;
}
}
&::-webkit-scrollbar-track {
&::-webkit-scrollbar-track {
...
@@ -59,7 +93,7 @@ const Preview = styled.div`
...
@@ -59,7 +93,7 @@ const Preview = styled.div`
&::-webkit-scrollbar-thumb {
&::-webkit-scrollbar-thumb {
background: #888;
background: #888;
border-radius:
4
px;
border-radius:
3
px;
}
}
&::-webkit-scrollbar-thumb:hover {
&::-webkit-scrollbar-thumb:hover {
...
@@ -68,15 +102,16 @@ const Preview = styled.div`
...
@@ -68,15 +102,16 @@ const Preview = styled.div`
`
;
`
;
const
DownloadButton
=
styled
.
button
`
const
DownloadButton
=
styled
.
button
`
padding:
12px 24
px;
padding:
8px 16
px;
background-color: #3498db;
background-color: #3498db;
color: white;
color: white;
border: none;
border: none;
border-radius:
5
px;
border-radius:
4
px;
cursor: pointer;
cursor: pointer;
font-size: 1
6
px;
font-size: 1
4
px;
transition: background-color 0.3s ease;
transition: background-color 0.3s ease;
align-self: flex-end;
align-self: flex-end;
margin-top: 10px;
&:hover {
&:hover {
background-color: #2980b9;
background-color: #2980b9;
...
@@ -129,20 +164,23 @@ function TextToImage() {
...
@@ -129,20 +164,23 @@ function TextToImage() {
};
};
return
(
return
(
<
Container
>
<
Wrapper
>
<
InputText
<
Title
>
文字卡片生成器
</
Title
>
placeholder=
"输入文本(可包含标题,如# 标题1)"
<
Container
>
value=
{
text
}
<
InputText
onChange=
{
(
e
)
=>
setText
(
e
.
target
.
value
)
}
placeholder=
"输入文本(可包含标题,如# 标题1)"
/>
value=
{
text
}
<
PreviewContainer
>
onChange=
{
(
e
)
=>
setText
(
e
.
target
.
value
)
}
<
Preview
ref=
{
previewRef
}
dangerouslySetInnerHTML=
{
{
__html
:
formatText
(
text
)
}
}
/>
/>
<
DownloadButton
onClick=
{
handleDownload
}
>
导出为图片
</
DownloadButton
>
<
PreviewContainer
>
</
PreviewContainer
>
<
Preview
</
Container
>
ref=
{
previewRef
}
dangerouslySetInnerHTML=
{
{
__html
:
formatText
(
text
)
}
}
/>
<
DownloadButton
onClick=
{
handleDownload
}
>
导出为图片
</
DownloadButton
>
</
PreviewContainer
>
</
Container
>
</
Wrapper
>
);
);
}
}
...
...
src/js/i18n.js
View file @
6b538bc4
...
@@ -3,8 +3,7 @@ import { useState, useEffect } from 'react';
...
@@ -3,8 +3,7 @@ import { useState, useEffect } from 'react';
const
i18n
=
{
const
i18n
=
{
zh
:
{
zh
:
{
title
:
'AI 工具箱'
,
title
:
'AI 工具箱'
,
slogan
:
'您的智能助手集合,一站式解决各种AI需求。'
,
slogan
:
'您的智能助手集合,一站式解决各种 AI 需求。'
,
searchPlaceholder
:
'搜索工具...'
,
tools
:
{
tools
:
{
text2image
:
{
text2image
:
{
title
:
'文字卡片'
,
title
:
'文字卡片'
,
...
@@ -21,7 +20,6 @@ const i18n = {
...
@@ -21,7 +20,6 @@ const i18n = {
en
:
{
en
:
{
title
:
'AI Toolbox'
,
title
:
'AI Toolbox'
,
slogan
:
'Your collection of intelligent assistants, solving various AI needs in one place.'
,
slogan
:
'Your collection of intelligent assistants, solving various AI needs in one place.'
,
searchPlaceholder
:
'Search tools...'
,
tools
:
{
tools
:
{
text2image
:
{
text2image
:
{
title
:
'Text to Image Card'
,
title
:
'Text to Image Card'
,
...
...
src/styles/Header.css
View file @
6b538bc4
.no-underline
{
.no-underline
{
text-decoration
:
none
;
text-decoration
:
none
;
color
:
inherit
;
/* 这会保持链接颜色与周围文本相同 */
color
:
inherit
;
}
}
.no-underline
:hover
{
.no-underline
:hover
{
text-decoration
:
none
;
/* 确保悬停时也不会出现下划线 */
text-decoration
:
none
;
}
}
.logo
{
.logo
{
width
:
40px
;
/* 调整为适合你的 logo 大小 */
width
:
40px
;
height
:
auto
;
height
:
40px
;
margin-right
:
10px
;
margin-right
:
15px
;
}
object-fit
:
contain
;
}
.title
{
font-size
:
1.5rem
;
/* 调整为适合你的设计 */
.title
{
white-space
:
nowrap
;
font-family
:
-apple-system
,
BlinkMacSystemFont
,
'Segoe UI'
,
'Roboto'
,
'Helvetica'
,
'Arial'
,
sans-serif
;
}
font-size
:
1.5rem
;
font-weight
:
500
;
header
nav
{
letter-spacing
:
0.02em
;
display
:
flex
;
color
:
#6366F1
;
/* 使用与图片中紫色渐变相近的颜色 */
justify-content
:
space-between
;
transition
:
color
0.2s
ease
;
align-items
:
center
;
}
padding
:
10px
20px
;
}
header
nav
{
display
:
flex
;
.logo-title-container
{
justify-content
:
space-between
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
padding
:
10px
20px
;
}
}
\ No newline at end of file
.logo-title-container
{
display
:
flex
;
align-items
:
center
;
animation
:
fadeIn
0.5s
ease-in-out
;
}
.logo-title-container
.title
{
display
:
flex
;
align-items
:
center
;
}
.logo-title-container
:hover
.title
{
color
:
#4F46E5
;
/* 悬停时稍微深一点的紫色 */
}
/* 添加一个简单的动画效果 */
@keyframes
fadeIn
{
from
{
opacity
:
0
;
}
to
{
opacity
:
1
;
}
}
/* 为移动设备优化 */
@media
(
max-width
:
768px
)
{
.title
{
font-size
:
1.3rem
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment