use tailwind in react project!

Introduction

Tailwindcss is a utility-first CSS framework that can be composed to build any design, directly in your markup.

This is a quick tutorial to show how tailwind can be configured in a fresh React application using create react app.

Creating a new React application

Create a new react application:

When I run yarn start and visit the default url localhost:3000 I can see the familiar React page:


How pet microchipping works

MyPet — microchip database and veterinary software

At MyPet, we believe that getting your pet microchipped is the best way of making sure you’re reunited if they get lost or stolen. All pets should be microchipped — a collar or tag can fall off or be removed, but a microchip is a more permanent way to identify your pet and keep them safe.


CODEX

Make a human-readable identifier for users on a ‘per team’ basis

Photo by Eric Krull on Unsplash

Problem

I have an application which has a table of users and a new requirement that these users have an incrementing identifier applied both for new users and existing users. I want to show how to achieve the database migration that needs to be written to retrospectively apply this identifier to existing users in the order that the users were created.

I want to add a unique identifier to my table which counts a user’s ‘number’ within a team retrospectively.

My users table:

The identifier column is the new column and I’d like to add. The first user in each…


What webhooks are, how webhooks work, and when to use them

Photo by Susan Yin on Unsplash

More and more companies are beginning to use Webhook technology in software integration, while interest in webhooks has grown considerably over the past 10 years according to Google Trends:


CODEX

Generate a “Hello world” larvel package in record time!

Photo by Oscar Sutton on Unsplash

Packages are the primary way of adding functionality to Laravel. This article will get you up and running quickly with a basic package.

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage them for you. For this tutorial you will need to have composer installed as a prerequisite. You can download composer here.

Create a new laravel project:

Open the project in your IDE.

Create the folder structure

The first thing to…


Improve tests for your laravel application

Photo by Jack B on Unsplash

Introduction

PHPUnit is a unit testing framework for the PHP programming language. Laravel has support for PHPUnit included out of the box, and a phpunit.xml file is already set up for your application.

In your project your tests directory will contain 2 directories: Feature and Unit. Unit tests are tests that focus on a very small, isolated portion of your code. In fact, most unit tests probably focus on a single method. …


CODEX

How to use them effectively

Photo by MICHAEL WILSON on Unsplash

Introduction

When building an api, many developers will use a transformation layer that sits between the models and the JSON responses that are returned to the application’s users.

As a Laravel developer you may be familiar with packages like this https://fractal.thephpleague.com/transformers/ however Laravel now has API resources built in since version 5.5 and over time many people have switched over.

Why even have a transformation layer?

Of course you can convert models or collections to JSON using their toJson method, however a transformer will give you more control over the JSON serialization of your models and their relationships. For example, you may want to always or sometimes…


Create reuseable modals without dependencies

Photo by Jungwoo Hong on Unsplash

Introduction

Any application can be boiled down to CRUD functions — to use a web application a user is either creating, reading, updating or deleting records. Many times you will want to get the user to confirm if they really want to perform a particular action — like “Do you really want to delete this?”.

A modal window creates a mode that disables the main window but keeps it visible, with the modal window as a child window in front of it. Users must interact with the window before they can return to the parent application.

In this tutorial I will…


Without adding extra dependencies to your project

I found myself running into this problem recently where I had a toggle switch to display a menu — but when I clicked on another part of the page, the menu did not disappear. I realised there are libraries out there such as this one https://github.com/simplesmiler/vue-clickaway but I’d rather not pull in another dependency if I don’t have to. I thought I would share one dependency-free way to hide the menu when the user clicks away from the toggle.

In a fresh vue project I started by making a basic toggle which shows…


Introduction

Tailwindcss is a utility-first CSS framework that can be composed to build any design, directly in your markup.

This is a quick tutorial to show how tailwind can be configured in a fresh Vue 3 application.

Create new Vue app

Assuming npm is installed, make sure you have the vue cli installed too:

Next, create a new vue project using the vue cli command:

Select the Vue 3 option when prompted. You can also chose Vue 2 as tailwindcss can be installed in the same way.

Now cd into the project and run npm run serve the…

Paul Reaney

I am a software developer and I like to write about interesting things I come across in my day to day.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store