NAME

Tags::HTML::Login::Button - Tags helper for login button.

SYNOPSIS

use Tags::HTML::Login::Button;

my $obj = Tags::HTML::Login::Button->new(%params);
$obj->process;
$obj->process_css;

METHODS

new

my $obj = Tags::HTML::Login::Button->new(%params);

Constructor.

Returns instance of object.

  • css

    'CSS::Struct::Output' object for process_css processing.

    Default value is undef.

  • link

    Login button link.

    Default value is 'login'.

  • tags

    'Tags::Output' object.

    Default value is undef.

  • title

    Login button title.

    Default value is 'LOGIN'.

process

$obj->process($percent_value);

Process Tags structure for gradient.

Returns undef.

process_css

$obj->process_css;

Process CSS::Struct structure for output.

Returns undef.

ERRORS

new():
        From Class::Utils::set_params():
                Unknown parameter '%s'.
        From Tags::HTML::new():
                Parameter 'css' must be a 'CSS::Struct::Output::*' class.
                Parameter 'tags' must be a 'Tags::Output::*' class.

process():
        From Tags::HTML::process():
                Parameter 'tags' isn't defined.

process_css():
        From Tags::HTML::process_css():
                Parameter 'css' isn't defined.

EXAMPLE1

use strict;
use warnings;

use CSS::Struct::Output::Indent;
use Tags::HTML::Login::Button;
use Tags::Output::Indent;

# Object.
my $css = CSS::Struct::Output::Indent->new;
my $tags = Tags::Output::Indent->new;
my $obj = Tags::HTML::Login::Button->new(
        'css' => $css,
        'tags' => $tags,
);

# Process login button.
$obj->process_css;
$tags->put(['b', 'body']);
$obj->process;
$tags->put(['e', 'body']);

# Print out.
print "CSS\n";
print $css->flush."\n\n";
print "HTML\n";
print $tags->flush."\n";

# Output:
# CSS
# .outer {
#         position: fixed;
#         top: 50%;
#         left: 50%;
#         transform: translate(-50%, -50%);
# }
# .login {
#         text-align: center;
# }
# .login a {
#         text-decoration: none;
#         background-image: linear-gradient(to bottom,#fff 0,#e0e0e0 100%);
#         background-repeat: repeat-x;
#         border: 1px solid #adadad;
#         border-radius: 4px;
#         color: black;
#         font-family: sans-serif!important;
#         padding: 15px 40px;
# }
# .login a:hover {
#         background-color: #e0e0e0;
#         background-image: none;
# }
#
# HTML
# <body class="outer">
#   <div class="login">
#     <a href="login">
#       LOGIN
#     </a>
#   </div>
# </body>

EXAMPLE2

use strict;
use warnings;

use CSS::Struct::Output::Indent;
use Plack::App::Tags::HTML;
use Plack::Runner;
use Tags::Output::Indent;
use Unicode::UTF8 qw(decode_utf8);

my $app = Plack::App::Tags::HTML->new(
        'component' => 'Tags::HTML::Login::Button',
        'constructor_args' => {
                'title' => decode_utf8('Přihlašovací tlačítko'),
        },
        'css' => CSS::Struct::Output::Indent->new,
        'tags' => Tags::Output::Indent->new(
                'xml' => 1,
                'preserved' => ['style'],
        ),
        'title' => decode_utf8('Přihlašovací tlačítko'),
)->to_app;
Plack::Runner->new->run($app);

# Output screenshot is in images/ directory.
Web app example

DEPENDENCIES

Class::Utils, Error::Pure, Tags::HTML.

SEE ALSO

Tags::HTML::Login::Access

Tags helper for login access.

REPOSITORY

https://github.com/michal-josef-spacek/Tags-HTML-Login-Button

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

© 2021-2023 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.04