-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
203 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters