Convert Bootstrap Template to Blazor (Part 7)

This is part 7 in my 7-part series on how to move a free Bootstrap Template and make a Blazor application out of it.  You can read about the other post here:

1. Part 1 – Create project and Copy over assets
2. Part 2 - Navigation
3. Part 3 – Header and Footer
4. Part 4 – About and Copyright
5. Part 5 – Contact Me
6. Part 6 - Portfolio

In this post we will be refactoring the button at the bottom of the page on the phone window size and providing a summary of this series.

Goto Top Button


This bottom allows the user to go back to the top.  This is the button:



As it turns out this refactor was less than expected.  We just had to create a new component, like we did on the other post.  We move the HTML code over into the new component.  There was an inline style that was moved to the CSS file.

We removed a JS script call to detected when to show the button, we just show it when the media type is meet.

Here is the code:

<!-- Scroll to Top Button (Only visible on small and extra-small screen sizes) -->
<div class="scroll-to-top d-lg-none position-fixed goto_top_display">
    <a class="d-block text-center text-white rounded" href="#page-top">
        <i class="fa fa-chevron-up"></i>
    </a>
</div>

Series Summary


This was an interesting series to do.  We went a little crazy with turning everything into a component, but it helps learn more of Blazor.   If I was to do this for another Bootstrap template, I feel it would take only a few hours.
The most surprising part was what we had to do to support anchor tags.  I would have thought this would be very straight forward for Blazor, but we ended up needing to use JavaScript.
The portfolio section was the most fun.  We were able to remover a lot of repeated code with C# logic, which is always fun.  I think I could have stored the source in GitHub better than coping over the entire project.
I don’t believe I would do another series this long.  I was running out of motivation by the end.

Thanks for sticking with the series.

[Source Code]










Comments

Popular posts from this blog

Yes, Blazor Server can scale!

Blazor new and improved Search Box

Blazor Wizard Step Component