mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
chore: handle header ui
This commit is contained in:
@ -79,7 +79,6 @@ export default function RemarkDirectiveTestPage() {
|
|||||||
<InSiteMessage
|
<InSiteMessage
|
||||||
title="Help Shape Dify"
|
title="Help Shape Dify"
|
||||||
subtitle="We’d love to hear how you evaluate and use Dify"
|
subtitle="We’d love to hear how you evaluate and use Dify"
|
||||||
title_pic_url="https://www.figma.com/api/mcp/asset/ee1209b5-5df1-48a6-8052-ad4a2a08a653"
|
|
||||||
main={inSiteMessageMain}
|
main={inSiteMessageMain}
|
||||||
actions={[
|
actions={[
|
||||||
{ type: 'default', text: 'Not now', action: 'close' },
|
{ type: 'default', text: 'Not now', action: 'close' },
|
||||||
|
|||||||
@ -18,10 +18,10 @@ export type InSiteMessageActionItem = {
|
|||||||
type InSiteMessageProps = {
|
type InSiteMessageProps = {
|
||||||
actions: InSiteMessageActionItem[]
|
actions: InSiteMessageActionItem[]
|
||||||
className?: string
|
className?: string
|
||||||
|
headerBgUrl?: string
|
||||||
main: string
|
main: string
|
||||||
subtitle: string
|
subtitle: string
|
||||||
title: string
|
title: string
|
||||||
title_pic_url?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeLinkData(data: unknown): { href: string, rel?: string, target?: string } | null {
|
function normalizeLinkData(data: unknown): { href: string, rel?: string, target?: string } | null {
|
||||||
@ -45,26 +45,18 @@ function normalizeLinkData(data: unknown): { href: string, rel?: string, target?
|
|||||||
function InSiteMessage({
|
function InSiteMessage({
|
||||||
actions,
|
actions,
|
||||||
className,
|
className,
|
||||||
|
headerBgUrl = '/in-site-message/header-bg.svg',
|
||||||
main,
|
main,
|
||||||
subtitle,
|
subtitle,
|
||||||
title,
|
title,
|
||||||
title_pic_url,
|
|
||||||
}: InSiteMessageProps) {
|
}: InSiteMessageProps) {
|
||||||
const [visible, setVisible] = useState(true)
|
const [visible, setVisible] = useState(true)
|
||||||
|
|
||||||
const headerStyle = useMemo(() => {
|
const headerStyle = useMemo(() => {
|
||||||
if (!title_pic_url) {
|
|
||||||
return {
|
|
||||||
background: 'linear-gradient(180deg, #3268f4 0%, #194ccf 100%)',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
backgroundImage: `linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.4) 100%), url(${title_pic_url})`,
|
backgroundImage: `url(${headerBgUrl})`,
|
||||||
backgroundPosition: 'center',
|
|
||||||
backgroundSize: 'cover',
|
|
||||||
}
|
}
|
||||||
}, [title_pic_url])
|
}, [headerBgUrl])
|
||||||
|
|
||||||
const handleAction = (item: InSiteMessageActionItem) => {
|
const handleAction = (item: InSiteMessageActionItem) => {
|
||||||
if (item.action === 'close') {
|
if (item.action === 'close') {
|
||||||
@ -95,7 +87,7 @@ function InSiteMessage({
|
|||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className="flex min-h-[128px] flex-col justify-end gap-0.5 px-4 pb-3 pt-6 text-white" style={headerStyle}>
|
<div className="flex min-h-[128px] flex-col justify-end gap-0.5 bg-cover px-4 pb-3 pt-6 text-white" style={headerStyle}>
|
||||||
<div className="text-[20px] font-bold leading-6">
|
<div className="text-[20px] font-bold leading-6">
|
||||||
{title}
|
{title}
|
||||||
</div>
|
</div>
|
||||||
@ -104,7 +96,7 @@ function InSiteMessage({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="markdown-body px-4 pb-2 pt-4 text-[14px] leading-5 text-text-secondary">
|
<div className="px-4 pb-2 pt-4 text-[14px] leading-5 text-text-secondary [&_p]:mb-2 [&_ul]:list-disc [&_ul]:pl-5">
|
||||||
<MarkdownWithDirective markdown={main} />
|
<MarkdownWithDirective markdown={main} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
33
web/public/in-site-message/header-bg.svg
Normal file
33
web/public/in-site-message/header-bg.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 4.6 MiB |
Reference in New Issue
Block a user