Creating a Section
.tsx
file in the sections/
folder.tsx
file in the sections/
folder of your site with the desired
name for the Section (e.g., Post.tsx
).
The Section is a Preact component that is configurable
in the Admin. For the Section to be visible in the Admin, you need to create
this component in the sections/
folder or one of its subdirectories.
export default
as
shown in the example below:
sections/Post.tsx
Post
component: one for an image
(photo
), another for the post body (post
), and one for the post time
(datetime
).
strings
and numbers
Pick
, or Omit
Sections
( import { Section } from "deco/blocks/section.ts"
)ImageWidget
(import type { ImageWidget } from "apps/admin/widgets.ts";
)
and other components from the admin@format
annotation, for example). Read
more about
these annotations here.
Post
component. The admin prepares its own
form components for inserting images, dates, and indicates what each field is
based on the title
provided in the code.
Theme.tsx
.
This section defines tokens and special class names that can be used by other
Sections following the DaisyUI tool structure. Inside Theme.tsx
, you can see
some tokens like the main color tokens:
Post
Section follows the site (or page) theme and uses the colors
defined in the theme.