-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from axzilla/dev
feat: add tooltip component
- Loading branch information
Showing
14 changed files
with
810 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
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
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,55 @@ | ||
package pages | ||
|
||
import ( | ||
"github.com/axzilla/templui/internals/ui/layouts" | ||
"github.com/axzilla/templui/internals/ui/modules" | ||
"github.com/axzilla/templui/internals/ui/showcase" | ||
) | ||
|
||
templ Tooltip() { | ||
@layouts.DocsLayout() { | ||
@modules.PageWrapper(modules.PageWrapperProps{ | ||
Name: "Tooltip", | ||
Description: templ.Raw("A small pop-up box that appears when a user hovers over an element"), | ||
Tailwind: true, | ||
Alpine: true, | ||
}) { | ||
@modules.ExampleWrapper(modules.ExampleWrapperProps{ | ||
ShowcaseFile: showcase.Tooltip(), | ||
PreviewCodeFile: "tooltip.templ", | ||
ComponentCodeFile: "tooltip.templ", | ||
}) | ||
@modules.Usage(modules.UsageProps{ | ||
ComponentName: "Tooltip", | ||
NeedsHandler: true, | ||
PropsExample: "...", | ||
}) | ||
@modules.ContainerWrapper(modules.ContainerWrapperProps{Title: "Examples"}) { | ||
@modules.ExampleWrapper(modules.ExampleWrapperProps{ | ||
SectionName: "With delay (3s open, 1s close)", | ||
ShowcaseFile: showcase.TooltipWithDelay(), | ||
PreviewCodeFile: "tooltip_with_delay.templ", | ||
ComponentCodeFile: "tooltip.templ", | ||
}) | ||
@modules.ExampleWrapper(modules.ExampleWrapperProps{ | ||
SectionName: "Variants", | ||
ShowcaseFile: showcase.TooltipVariants(), | ||
PreviewCodeFile: "tooltip_variants.templ", | ||
ComponentCodeFile: "tooltip.templ", | ||
}) | ||
@modules.ExampleWrapper(modules.ExampleWrapperProps{ | ||
SectionName: "Sides", | ||
ShowcaseFile: showcase.TooltipSides(), | ||
PreviewCodeFile: "tooltip_sides.templ", | ||
ComponentCodeFile: "tooltip.templ", | ||
}) | ||
@modules.ExampleWrapper(modules.ExampleWrapperProps{ | ||
SectionName: "With Arrow", | ||
ShowcaseFile: showcase.TooltipWithArrow(), | ||
PreviewCodeFile: "tooltip_with_arrow.templ", | ||
ComponentCodeFile: "tooltip.templ", | ||
}) | ||
} | ||
} | ||
} | ||
} |
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,13 @@ | ||
package showcase | ||
|
||
import "github.com/axzilla/templui/pkg/components" | ||
|
||
templ Tooltip() { | ||
@components.Tooltip(components.TooltipProps{ | ||
Trigger: components.Button(components.ButtonProps{ | ||
Text: "Hover me", | ||
Variant: components.ButtonVariantOutline, | ||
}), | ||
Content: templ.Raw("Default"), | ||
}) | ||
} |
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,40 @@ | ||
package showcase | ||
|
||
import "github.com/axzilla/templui/pkg/components" | ||
|
||
templ TooltipSides() { | ||
<div class="flex flex-wrap gap-2"> | ||
@components.Tooltip(components.TooltipProps{ | ||
Trigger: components.Button(components.ButtonProps{ | ||
Text: "Top", | ||
Variant: components.ButtonVariantOutline, | ||
}), | ||
Content: templ.Raw("Top tooltip"), | ||
Side: components.TooltipTop, // Its the default value but we can set it explicitly | ||
}) | ||
@components.Tooltip(components.TooltipProps{ | ||
Trigger: components.Button(components.ButtonProps{ | ||
Text: "Right", | ||
Variant: components.ButtonVariantOutline, | ||
}), | ||
Content: templ.Raw("Right tooltip"), | ||
Side: components.TooltipRight, | ||
}) | ||
@components.Tooltip(components.TooltipProps{ | ||
Trigger: components.Button(components.ButtonProps{ | ||
Text: "Bottom", | ||
Variant: components.ButtonVariantOutline, | ||
}), | ||
Content: templ.Raw("Bottom tooltip"), | ||
Side: components.TooltipBottom, | ||
}) | ||
@components.Tooltip(components.TooltipProps{ | ||
Trigger: components.Button(components.ButtonProps{ | ||
Text: "Left", | ||
Variant: components.ButtonVariantOutline, | ||
}), | ||
Content: templ.Raw("Left tooltip"), | ||
Side: components.TooltipLeft, | ||
}) | ||
</div> | ||
} |
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,31 @@ | ||
package showcase | ||
|
||
import "github.com/axzilla/templui/pkg/components" | ||
|
||
templ TooltipVariants() { | ||
<div class="flex flex-wrap gap-2"> | ||
@components.Tooltip(components.TooltipProps{ | ||
Trigger: components.Button(components.ButtonProps{ | ||
Text: "Default", | ||
Variant: components.ButtonVariantOutline, | ||
}), | ||
Content: templ.Raw("Default tooltip"), | ||
}) | ||
@components.Tooltip(components.TooltipProps{ | ||
Trigger: components.Button(components.ButtonProps{ | ||
Text: "Secondary", | ||
Variant: components.ButtonVariantOutline, | ||
}), | ||
Content: templ.Raw("Secondary tooltip"), | ||
Variant: components.TooltipSecondary, | ||
}) | ||
@components.Tooltip(components.TooltipProps{ | ||
Trigger: components.Button(components.ButtonProps{ | ||
Text: "Destructive", | ||
Variant: components.ButtonVariantOutline, | ||
}), | ||
Content: templ.Raw("Destructive tooltip"), | ||
Variant: components.TooltipDestructive, | ||
}) | ||
</div> | ||
} |
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,44 @@ | ||
package showcase | ||
|
||
import "github.com/axzilla/templui/pkg/components" | ||
|
||
templ TooltipWithArrow() { | ||
<div class="flex flex-wrap gap-2"> | ||
@components.Tooltip(components.TooltipProps{ | ||
Trigger: components.Button(components.ButtonProps{ | ||
Text: "Top", | ||
Variant: components.ButtonVariantOutline, | ||
}), | ||
Content: templ.Raw("Top tooltip"), | ||
Side: components.TooltipTop, // Its the default value but we can set it explicitly | ||
ShowArrow: true, | ||
}) | ||
@components.Tooltip(components.TooltipProps{ | ||
Trigger: components.Button(components.ButtonProps{ | ||
Text: "Right", | ||
Variant: components.ButtonVariantOutline, | ||
}), | ||
Content: templ.Raw("Right tooltip"), | ||
Side: components.TooltipRight, | ||
ShowArrow: true, | ||
}) | ||
@components.Tooltip(components.TooltipProps{ | ||
Trigger: components.Button(components.ButtonProps{ | ||
Text: "Bottom", | ||
Variant: components.ButtonVariantOutline, | ||
}), | ||
Content: templ.Raw("Bottom tooltip"), | ||
Side: components.TooltipBottom, | ||
ShowArrow: true, | ||
}) | ||
@components.Tooltip(components.TooltipProps{ | ||
Trigger: components.Button(components.ButtonProps{ | ||
Text: "Left", | ||
Variant: components.ButtonVariantOutline, | ||
}), | ||
Content: templ.Raw("Left tooltip"), | ||
Side: components.TooltipLeft, | ||
ShowArrow: true, | ||
}) | ||
</div> | ||
} |
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 @@ | ||
package showcase | ||
|
||
import "github.com/axzilla/templui/pkg/components" | ||
|
||
templ TooltipWithDelay() { | ||
@components.Tooltip(components.TooltipProps{ | ||
Trigger: components.Button(components.ButtonProps{ | ||
Text: "Hover me", | ||
Variant: components.ButtonVariantOutline, | ||
}), | ||
Content: templ.Raw("With delay"), | ||
OpenDelay: 3000, | ||
CloseDelay: 1000, | ||
}) | ||
} |
Oops, something went wrong.