Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Col0ring committed Nov 12, 2024
1 parent e9bc440 commit 5b9fe20
Show file tree
Hide file tree
Showing 14 changed files with 203 additions and 2 deletions.
11 changes: 10 additions & 1 deletion docs/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,17 @@ def get_docs(file_path: str, type: Literal["antd", "base"]):
"label": get_text("Flex", "Flex 弹性布局"),
"key": "flex"
}, {
"label": get_text("Grid", "Grid 栅格布局"),
"label": get_text("Grid", "Grid 栅格"),
"key": "grid"
}, {
"label": get_text("Layout", "Layout 布局"),
"key": "layout"
}, {
"label": get_text("Space", "Space 间距"),
"key": "space"
}, {
"label": get_text("Splitter", "Splitter 分割面板"),
"key": "splitter"
}]
}]

Expand Down
7 changes: 7 additions & 0 deletions docs/components/antd/layout/README-zh_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Layout

Handling the overall layout of a page. See [Ant Design](https://ant.design/components/layout/) for more information.

## Examples

<demo name="basic"></demo>
7 changes: 7 additions & 0 deletions docs/components/antd/layout/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Layout

Handling the overall layout of a page. See [Ant Design](https://ant.design/components/layout/) for more information.

## Examples

<demo name="basic"></demo>
6 changes: 6 additions & 0 deletions docs/components/antd/layout/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from helper.Docs import Docs

docs = Docs(__file__)

if __name__ == "__main__":
docs.render().queue().launch()
88 changes: 88 additions & 0 deletions docs/components/antd/layout/demos/basic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import gradio as gr

import modelscope_studio.components.antd as antd
import modelscope_studio.components.base as ms

header_style = {
"textAlign": 'center',
"color": '#fff',
"height": 64,
"paddingInline": 48,
"lineHeight": '64px',
"backgroundColor": '#4096ff',
}

content_style = {
"textAlign": 'center',
"minHeight": 120,
"lineHeight": '120px',
"color": '#fff',
"backgroundColor": '#0958d9',
}

sider_style = {
"textAlign": 'center',
"lineHeight": '120px',
"color": '#fff',
"backgroundColor": '#1677ff',
}

footer_style = {
"textAlign": 'center',
"color": '#fff',
"backgroundColor": '#4096ff',
}

layout_style = {
"borderRadius": 8,
"overflow": 'hidden',
"width": 'calc(50% - 8px)',
"maxWidth": 'calc(50% - 8px)',
}

with gr.Blocks() as demo:
with ms.Application():
with antd.ConfigProvider():
with antd.Flex(gap="middle", wrap="wrap"):
with antd.Layout(elem_style=layout_style):
with antd.Layout.Header(elem_style=header_style):
ms.Text("Header")
with antd.Layout.Content(elem_style=content_style):
ms.Text("Content")
with antd.Layout.Footer(elem_style=footer_style):
ms.Text("Footer")
with antd.Layout(elem_style=layout_style):
with antd.Layout.Header(elem_style=header_style):
ms.Text("Header")
with antd.Layout():
with antd.Layout.Sider(width="25%",
elem_style=sider_style):
ms.Text("Sider")
with antd.Layout.Content(elem_style=content_style):
ms.Text("Content")
with antd.Layout.Footer(elem_style=footer_style):
ms.Text("Footer")
with antd.Layout(elem_style=layout_style):
with antd.Layout.Header(elem_style=header_style):
ms.Text("Header")
with antd.Layout():
with antd.Layout.Content(elem_style=content_style):
ms.Text("Content")
with antd.Layout.Sider(width="25%",
elem_style=sider_style):
ms.Text("Sider")
with antd.Layout.Footer(elem_style=footer_style):
ms.Text("Footer")
with antd.Layout(elem_style=layout_style):
with antd.Layout.Sider(width="25%",
elem_style=sider_style):
ms.Text("Sider")
with antd.Layout():
with antd.Layout.Header(elem_style=header_style):
ms.Text("Header")
with antd.Layout.Content(elem_style=content_style):
ms.Text("Content")
with antd.Layout.Footer(elem_style=footer_style):
ms.Text("Footer")
if __name__ == "__main__":
demo.queue().launch()
7 changes: 7 additions & 0 deletions docs/components/antd/space/README-zh_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Space

Set components spacing. See [Ant Design](https://ant.design/components/space/) for more information.

## Examples

<demo name="basic"></demo>
7 changes: 7 additions & 0 deletions docs/components/antd/space/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Space

Set components spacing. See [Ant Design](https://ant.design/components/space/) for more information.

## Examples

<demo name="basic"></demo>
6 changes: 6 additions & 0 deletions docs/components/antd/space/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from helper.Docs import Docs

docs = Docs(__file__)

if __name__ == "__main__":
docs.render().queue().launch()
15 changes: 15 additions & 0 deletions docs/components/antd/space/demos/basic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import gradio as gr

import modelscope_studio.components.antd as antd
import modelscope_studio.components.base as ms

with gr.Blocks() as demo:
with ms.Application():
with antd.ConfigProvider():
with antd.Space():
antd.Button("Primary", type="primary")
antd.Button("Default")
antd.Button("Dashed", type="dashed")
ms.Text("Space")
if __name__ == "__main__":
demo.queue().launch()
7 changes: 7 additions & 0 deletions docs/components/antd/splitter/README-zh_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Splitter

Split panels to isolate. See [Ant Design](https://ant.design/components/space/) for more information.

## Examples

<demo name="basic"></demo>
7 changes: 7 additions & 0 deletions docs/components/antd/splitter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Splitter

Split panels to isolate. See [Ant Design](https://ant.design/components/space/) for more information.

## Examples

<demo name="basic"></demo>
6 changes: 6 additions & 0 deletions docs/components/antd/splitter/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from helper.Docs import Docs

docs = Docs(__file__)

if __name__ == "__main__":
docs.render().queue().launch()
30 changes: 30 additions & 0 deletions docs/components/antd/splitter/demos/basic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import gradio as gr

import modelscope_studio.components.antd as antd
import modelscope_studio.components.base as ms


def Desc(text: str):
with antd.Flex(justify="center"):
with antd.Typography.Title(type="secondary",
level=5,
elem_style=dict(whiteSpace="nowrap")):
ms.Text(text)


with gr.Blocks() as demo:
with ms.Application():
with antd.ConfigProvider():
with antd.Splitter(elem_style=dict(
height=500, boxShadow='0 0 10px rgba(0, 0, 0, 0.1)')):
with antd.Splitter.Panel(collapsible=True):
Desc("Left")
with antd.Splitter.Panel(collapsible=True):
with antd.Splitter(layout="vertical"):
with antd.Splitter.Panel():
Desc("Top")
with antd.Splitter.Panel():
Desc("Bottom")

if __name__ == "__main__":
demo.queue().launch()
1 change: 0 additions & 1 deletion frontend/antd/input/textarea/input.textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export const InputTextarea = sveltify<
onValueChange,
value: props.value,
});

return (
<>
<div style={{ display: 'none' }}>{children}</div>
Expand Down

0 comments on commit 5b9fe20

Please sign in to comment.