Reflexjs
文档区块库指南GitHub
/
,

区块表单区块

表单 002
全屏查看

如何使用此区块

1. 复制区块源代码,并将其粘贴到 src/components/form-002.jsx 文件中。

区块(JavaScript)
import * as React from "react"
import { VisuallyHidden } from "reflexjs"
export default function Block({ subheading, heading, text, ...props }) {
return (
<section py="6|8|12|20" {...props}>
<div variant="container">
<div
display="flex"
flexDirection="column"
justifyContent="center"
alignItems="center"
textAlign="center"
>
{subheading && (
<p color="primary" textTransform="uppercase" m="0">
{subheading}
</p>
)}
{heading && (
<h1 variant="heading.h1" fontWeight="bolder" lineHeight="tight">
{heading}
</h1>
)}
{text && (
<p variant="text.lead" mt="2">
{text}
</p>
)}
<form display="grid" col="1|auto auto" mt="6" gap="4" w="full|auto">
<VisuallyHidden>
<label htmlFor="email">Email</label>
</VisuallyHidden>
<input
variant="input"
type="email"
id="form-04-email"
name="email"
placeholder="Type your email"
/>
<button type="submit" variant="button.primary">
Subscribe
</button>
</form>
</div>
</div>
</section>
)
}

2. 复制以下示例代码,并将其添加到您的页面中。

用法(JavaScript)
import * as React from "react"
import Block from "../src/components/form-002"
export default function Example() {
return (
<Block
subheading="Subheading"
heading="Turn followers into customers"
text="Reiciendis quia totam esse. Dicta minus iusto quisquam doloribus temporibus."
/>
)
}

© 2022 Reflexjs

文档区块库指南GitHub