def myPage(name): main = container() welcome = blockquote(f"Welcome to Incantation, {name}!") title = blockquote("Incantation使用者的评价反馈") users = table(["姓名", "评价", "日期"], [["Misakawa", "我自己做的,还能不给自己好评吗?完美的抽象!10/10分!", "2017-10-28"], ["Thautwarm", "上面那个是我小号...", "2017-10-28"], ["Ruikowa", "十分 and 我是被小号的。", "2017-10-29"]]) side = collections([ badge(new=True, href='#!', num=1, name='关注'), badge(new=True, href='#!', num=4, name='评论'), badge(href='#!', name='私信'), badge(new=False, href='#!', num=6, name='你的组织'), badge(href='#!', name='用户设置'), badge(href='#!', name='帮助反馈'), ]) main.contains( Seq( welcome, divider(), "<br>", row( Seq( col(side, grid(l=3, s=3, m=3)), col(Seq(title, users), grid(l=8, s=8, m=8)), )))) page = Page(main) return page.gen()
def collapsibles(): main = container() collap = collapsible([(icon('filter_drama'), badge(href='#!', name="First"), "<p>Lorem ipsum dolor sit amet.</p>"), (icon('place'), badge(href='#!', name="Second"), "place")]) main.contains(collap) return Page(main).gen()
def my_page(hasContainer: bool): a_row = row("This is a row.") a_row.cons_class(color('red').gen()) if hasContainer: main = container() main.contains(a_row) res = main else: res = a_row return Page(res).gen()
def dropdown(): main = container() c = globals()['dropdown']([ badge(new=False, href='#!', num=1, name='Alan'), badge(new=True, href='#!', num=4, name='Alan'), badge(href='#!', name='Alan'), badge(new=False, href='#!', num=14, name='Alan') ], name='a dropdown list', id='someid') main.contains(c) return Page(Seq('<br>' * 3, main)).gen()
def multifields(): main = container() username = input_field(grid(l=5), field_name='username', type='text', icon=Icons.account_circle, id='username') password = input_field(grid(l=5), field_name='password', type='password', icon=icon('exposure_plus_1'), id='password') a_row = row(Seq(username, password)) a_form = form(Seq("<br>" * 2, divider(), a_row)) main.contains(a_form) return Page(main).gen()
def test(): main = container() content1 = \ collections([badge(href='#!', num=1, name='今日新闻'), badge(href='#!', num=4, name='鬼畜专区'), badge(href='#!', name='哲学论坛'), badge(href='#!', num=14, name='血条众筹'), ]) content2 = \ collapsible([(icon('filter_drama'),badge(href = '#!', name = "First") , "<p>Lorem ipsum dolor sit amet.</p>"), (icon('place'), badge(href = '#!', name = "Second"), "place") ]) side = col(sidenav([content2, content1]), grid(l=2).loffset(6)) main.contains(side) return Page(main).gen()
def normal(): main = container() a_form = form( Seq( "<br>" * 2, divider(), input_field(grid(l=10), field_name='username', type='text', icon=Icons.account_circle, id='username'), input_field(grid(l=10), field_name='password', type='password', icon=icon('exposure_plus_1'), id='password'))) main.contains(a_form) return Page(main).gen()
def index(ucolor): space = ' ' main = container() bar = navbar([ { 'name': '百度', 'href': 'https://www.baidu.com' }, dict(name='Glgoo', href='https://scholar.glgoo.org/'), ], href='#Bar', name=f'{space*5}Bar') html_color = color(major=ucolor).gen() bar.cons_class(html_color) # 从对象class的头部添加值 main.contains(bar) return Page(main).gen()
def raised(): raised = globals()['raised'] more = raised(icon=icon('cloud'), name=" More", href='https://www.zhihu.com') a_row = row(more) right_align(a_row) more.cons_class(color('green').gen()) collection=\ collections([badge(new=True, href='#!', num=1, name='今日新闻'), badge(new=True, href='#!', num=4, name='鬼畜专区'), badge(href='#!', name='哲学论坛'), badge(new=False, href='#!', num=14, name='血条众筹'), ]) main = container() main.contains(Seq(collection, a_row)) return Page(main).gen()
from incantation.Module.CSS.Color import Indigo from incantation.Module.CSS.Helpers import align, left_align, right_align, center_align from incantation.Module.CSS.Media import video_container from incantation.Module import abst from incantation.Module import blockquote from incantation.Module.CSS.Table import table from incantation.Module.abst import default_conf, gen_helper, Seq from incantation.template import Page from incantation.Module.Component.Badges import collections, dropdown, badge, collapsible from incantation.Module.Component.Icons import icon from incantation.Module.Component.Button import FAB, raised from incantation.Module.Component.Form import form, input_field from incantation.Module.Component.Navbar import navbar # create a container main = container() # create a navbar nav = navbar([ dict(href='https://baidu.com', name='link1'), dict(href='https://google.com', name='link2') ], href='https://github.com/thautwarm', name='Logo') # create collections collect = collections([ badge(new=False, href='#!', num=1, name='Alan'), badge(new=True, href='#!', num=4, name='Alan'), badge(href='#!', name='Alan'), badge(new=False, href='#!', num=14, name='Alan')
def index(): main = container() main.contains( Seq(section('<h5>A</h5><p>a</p>'), divider(), section('<h>B</h><p>b</p>'))) return Page(main).gen()