mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 21:09:11 +00:00
181 lines
8.0 KiB
Go
181 lines
8.0 KiB
Go
|
// Code generated by templ - DO NOT EDIT.
|
||
|
|
||
|
// templ: version: v0.2.771
|
||
|
package elements
|
||
|
|
||
|
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||
|
|
||
|
import "github.com/a-h/templ"
|
||
|
import templruntime "github.com/a-h/templ/runtime"
|
||
|
|
||
|
func Button(variant Variant) templ.Component {
|
||
|
return renderButton(variant.Attributes())
|
||
|
}
|
||
|
|
||
|
func renderButton(attrs templ.Attributes) templ.Component {
|
||
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||
|
if !templ_7745c5c3_IsBuffer {
|
||
|
defer func() {
|
||
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||
|
if templ_7745c5c3_Err == nil {
|
||
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||
|
}
|
||
|
}()
|
||
|
}
|
||
|
ctx = templ.InitializeContext(ctx)
|
||
|
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||
|
if templ_7745c5c3_Var1 == nil {
|
||
|
templ_7745c5c3_Var1 = templ.NopComponent
|
||
|
}
|
||
|
ctx = templ.ClearChildren(ctx)
|
||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button")
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">")
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer)
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</button>")
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
return templ_7745c5c3_Err
|
||
|
})
|
||
|
}
|
||
|
|
||
|
type ButtonVariant int
|
||
|
|
||
|
const (
|
||
|
ButtonVariantDefault ButtonVariant = iota
|
||
|
ButtonVariantPrimary
|
||
|
ButtonVariantInfo
|
||
|
ButtonVariantError
|
||
|
ButtonVariantSuccess
|
||
|
ButtonVariantWarning
|
||
|
)
|
||
|
|
||
|
func (v ButtonVariant) Attributes() templ.Attributes {
|
||
|
switch v {
|
||
|
case ButtonVariantPrimary:
|
||
|
return templ.Attributes{
|
||
|
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-neutral-950 hover:bg-neutral-900 focus:ring-2 focus:ring-offset-2 focus:ring-neutral-900 focus:shadow-outline focus:outline-none",
|
||
|
"type": "button",
|
||
|
}
|
||
|
case ButtonVariantInfo:
|
||
|
return templ.Attributes{
|
||
|
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 bg-blue-600 rounded-md hover:bg-blue-700 focus:ring-2 focus:ring-offset-2 focus:ring-blue-700 focus:shadow-outline focus:outline-none",
|
||
|
"type": "button",
|
||
|
}
|
||
|
case ButtonVariantError:
|
||
|
return templ.Attributes{
|
||
|
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-red-600 hover:bg-red-700 focus:ring-2 focus:ring-offset-2 focus:ring-red-700 focus:shadow-outline focus:outline-none",
|
||
|
"type": "button",
|
||
|
}
|
||
|
case ButtonVariantSuccess:
|
||
|
return templ.Attributes{
|
||
|
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-green-600 hover:bg-green-700 focus:ring-2 focus:ring-offset-2 focus:ring-green-700 focus:shadow-outline focus:outline-none",
|
||
|
"type": "button",
|
||
|
}
|
||
|
case ButtonVariantWarning:
|
||
|
return templ.Attributes{
|
||
|
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-yellow-600 hover:bg-yellow-700 focus:ring-2 focus:ring-offset-2 focus:ring-yellow-700 focus:shadow-outline focus:outline-none",
|
||
|
"type": "button",
|
||
|
}
|
||
|
}
|
||
|
return templ.Attributes{
|
||
|
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-200 bg-white border rounded-md text-neutral-500 hover:text-neutral-700 border-neutral-200/70 hover:bg-neutral-100 active:bg-white focus:bg-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-200/60 focus:shadow-outline",
|
||
|
"type": "button",
|
||
|
}
|
||
|
}
|
||
|
|
||
|
type SubtleButtonVariant int
|
||
|
|
||
|
const (
|
||
|
SubtleButtonVariantDefault SubtleButtonVariant = iota
|
||
|
SubtleButtonVariantInfo
|
||
|
SubtleButtonVariantError
|
||
|
SubtleButtonVariantSuccess
|
||
|
SubtleButtonVariantWarning
|
||
|
)
|
||
|
|
||
|
func (v SubtleButtonVariant) Attributes() templ.Attributes {
|
||
|
switch v {
|
||
|
case SubtleButtonVariantInfo:
|
||
|
return templ.Attributes{
|
||
|
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-blue-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-blue-100 bg-blue-50 hover:text-blue-600 hover:bg-blue-100",
|
||
|
"type": "button",
|
||
|
}
|
||
|
case SubtleButtonVariantError:
|
||
|
return templ.Attributes{
|
||
|
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-red-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-red-100 bg-red-50 hover:text-red-600 hover:bg-red-100",
|
||
|
"type": "button",
|
||
|
}
|
||
|
case SubtleButtonVariantSuccess:
|
||
|
return templ.Attributes{
|
||
|
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-green-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-green-100 bg-green-50 hover:text-green-600 hover:bg-green-100",
|
||
|
"type": "button",
|
||
|
}
|
||
|
case SubtleButtonVariantWarning:
|
||
|
return templ.Attributes{
|
||
|
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-yellow-600 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-yellow-100 bg-yellow-50 hover:text-yellow-700 hover:bg-yellow-100",
|
||
|
"type": "button",
|
||
|
}
|
||
|
}
|
||
|
return templ.Attributes{
|
||
|
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-100 rounded-md text-neutral-500 bg-neutral-50 focus:ring-2 focus:ring-offset-2 focus:ring-neutral-100 hover:text-neutral-600 hover:bg-neutral-100",
|
||
|
"type": "button",
|
||
|
}
|
||
|
}
|
||
|
|
||
|
type OutlineButtonVariant int
|
||
|
|
||
|
const (
|
||
|
OutlineButtonVariantDefault OutlineButtonVariant = iota
|
||
|
OutlineButtonVariantInfo
|
||
|
OutlineButtonVariantError
|
||
|
OutlineButtonVariantSuccess
|
||
|
OutlineButtonVariantWarning
|
||
|
)
|
||
|
|
||
|
func (v OutlineButtonVariant) Attributes() templ.Attributes {
|
||
|
switch v {
|
||
|
case OutlineButtonVariantInfo:
|
||
|
return templ.Attributes{
|
||
|
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-blue-600 transition-colors duration-100 bg-white border-2 border-blue-600 rounded-md hover:text-white hover:bg-blue-600",
|
||
|
"type": "button",
|
||
|
}
|
||
|
case OutlineButtonVariantError:
|
||
|
return templ.Attributes{
|
||
|
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-red-600 transition-colors duration-100 bg-white border-2 border-red-600 rounded-md hover:text-white hover:bg-red-600",
|
||
|
"type": "button",
|
||
|
}
|
||
|
case OutlineButtonVariantSuccess:
|
||
|
return templ.Attributes{
|
||
|
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-green-600 transition-colors duration-100 bg-white border-2 border-green-600 rounded-md hover:text-white hover:bg-green-600",
|
||
|
"type": "button",
|
||
|
}
|
||
|
case OutlineButtonVariantWarning:
|
||
|
return templ.Attributes{
|
||
|
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-yellow-600 transition-colors duration-100 bg-white border-2 border-yellow-500 rounded-md hover:text-white hover:bg-yellow-500",
|
||
|
"type": "button",
|
||
|
}
|
||
|
}
|
||
|
return templ.Attributes{
|
||
|
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-100 bg-white border-2 rounded-md text-neutral-900 hover:text-white border-neutral-900 hover:bg-neutral-900",
|
||
|
"type": "button",
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var _ = templruntime.GeneratedTemplate
|