77 FunctionDefinition ,
88 FunctionParameters ,
99} from "../ui" ;
10+ import { DeprecationWarning } from "../ui/DeprecationWarning" ;
1011
1112export type FuncTemplateProps = Omit < BaseTemplateProps , "page" > & {
1213 page : Omit < Page , "body" > & {
@@ -31,78 +32,60 @@ export const FuncTemplate: FC<FuncTemplateProps> = ({
3132 previousPage = { previousPage }
3233 nextPage = { nextPage }
3334 >
34- < h1 id = "summary" >
35+ < h1 id = "summary" class = "flex items-center gap-2 mb-6" >
3536 < code > { content . name } </ code >
36- < small >
37- { content . element && (
38- < Tooltip
39- name = "Element"
40- desc = "Element functions can be customized with <code>set</code> and <code>show</code> rules."
41- />
42- ) }
43- { content . contextual && (
44- < Tooltip
45- name = "Contextual"
46- desc = "Contextual functions can only be used when the context is known"
47- />
48- ) }
37+ < small class = "flex items-center gap-1" >
38+ { content . element && < Tooltip kind = "element" /> }
39+ { content . contextual && < Tooltip kind = "contextual" /> }
4940 </ small >
50- { content . deprecation && (
51- < small class = "deprecation" >
52- < div class = "tooltip-context" >
53- < svg
54- width = "16"
55- height = "16"
56- viewBox = "0 0 16 16"
57- tabIndex = { 0 }
58- role = "img"
59- aria-labelledby = { `${ content . name } -deprecation-tooltip` }
60- >
61- < title id = { `${ content . name } -deprecation-tooltip` } >
62- Warning
63- </ title >
64- < use href = "/assets/icons/16-warn.svg#icon" > </ use >
65- </ svg >
66- </ div >
67- < span >
68- < span > { content . deprecation } </ span >
69- </ span >
70- </ small >
71- ) }
7241 </ h1 >
7342
74- < div dangerouslySetInnerHTML = { { __html : content . details } } />
43+ { content . deprecation && (
44+ < div className = "mt-2" >
45+ < DeprecationWarning message = { content . deprecation } />
46+ </ div >
47+ ) }
7548
76- < h2 id = "parameters" >
77- < Tooltip
78- name = "引数"
79- desc = "Parameters are the inputs to a function. They are specified in parentheses after the function name."
80- prefix = "parameters"
81- />
49+ < div
50+ class = "my-4 text-gray-700 [&_img]:mx-auto [&_img]:block [&_img]:max-w-full"
51+ dangerouslySetInnerHTML = { { __html : content . details } }
52+ />
53+
54+ < h2 id = "parameters" class = "flex items-baseline gap-1" >
55+ 引数
56+ < Tooltip kind = "parameters" />
8257 </ h2 >
8358
84- < FunctionDefinition func = { content } prefix = { content . name } />
59+ < div class = "mb-6" >
60+ < FunctionDefinition func = { content } prefix = { content . name } />
61+ </ div >
8562
8663 { content . example && (
87- < div dangerouslySetInnerHTML = { { __html : content . example } } />
64+ < div
65+ class = "my-6 bg-gray-50 p-4 rounded-md border border-gray-200"
66+ dangerouslySetInnerHTML = { { __html : content . example } }
67+ />
8868 ) }
8969
90- < FunctionParameters func = { content } prefix = { content . name } />
70+ < div class = "my-6" >
71+ < FunctionParameters func = { content } prefix = { content . name } />
72+ </ div >
9173
9274 { content . scope . length > 0 && (
93- < >
94- < h2 id = "definitions" >
95- < Tooltip
96- name = "定義"
97- desc = "Functions and types and can have associated definitions. These are accessed by specifying the function or type, followed by a period, and then the definition's name."
98- prefix = "definitions"
99- />
75+ < div class = "mt-8" >
76+ < h2 id = "definitions" class = "flex items-baseline gap-1" >
77+ 定義
78+ < Tooltip kind = "definitions" />
10079 </ h2 >
10180
10281 { content . scope . map ( ( method , index ) => (
103- < div >
104- < h3 id = { `definitions-${ method . name } ` } class = "method-head" >
82+ < div class = "mb-8 pb-6 border-b border-gray-100 last:border-0" >
83+ < h3
84+ id = { `definitions-${ method . name } ` }
85+ class = "method-head mb-3 flex items-center gap-2"
86+ >
10587 < code
88+ class = "text-base font-medium"
10689 style = {
10790 method . deprecation
10891 ? { textDecoration : "line-through" }
@@ -112,55 +95,27 @@ export const FuncTemplate: FC<FuncTemplateProps> = ({
11295 { method . name }
11396 </ code >
11497
115- < small >
116- { method . element && (
117- < Tooltip
118- name = "Element"
119- desc = "Element functions can be customized with <code>set</code> and <code>show</code> rules."
120- />
121- ) }
122- { method . contextual && (
123- < Tooltip
124- name = "Contextual"
125- desc = "Contextual functions can only be used when the context is known"
126- />
127- ) }
98+ < small class = "flex items-center" >
99+ { method . element && < Tooltip kind = "element" /> }
100+ { method . contextual && < Tooltip kind = "contextual" /> }
128101 </ small >
129-
130- { /* 非推奨表示 */ }
131- { method . deprecation && (
132- < small class = "deprecation" >
133- < div class = "tooltip-context" >
134- < svg
135- width = "16"
136- height = "16"
137- viewBox = "0 0 16 16"
138- tabIndex = { 0 }
139- role = "img"
140- aria-labelledby = { `definitions-${ method . name } -deprecation-tooltip` }
141- >
142- < title
143- id = { `definitions-${ method . name } -deprecation-tooltip` }
144- >
145- Warning
146- </ title >
147- < use href = "/assets/icons/16-warn.svg#icon" > </ use >
148- </ svg >
149- </ div >
150- < span >
151- < span > { method . deprecation } </ span >
152- </ span >
153- </ small >
154- ) }
155102 </ h3 >
156103
157- < FunctionDisplay
158- func = { method }
159- prefix = { `definitions-${ method . name } ` }
160- />
104+ { method . deprecation && (
105+ < div className = "mt-1" >
106+ < DeprecationWarning message = { method . deprecation } />
107+ </ div >
108+ ) }
109+
110+ < div class = "pl-2" >
111+ < FunctionDisplay
112+ func = { method }
113+ prefix = { `definitions-${ method . name } ` }
114+ />
115+ </ div >
161116 </ div >
162117 ) ) }
163- </ >
118+ </ div >
164119 ) }
165120 </ BaseTemplate >
166121 ) ;
0 commit comments