<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sam Turrell</title>
    <description>The latest articles on DEV Community by Sam Turrell (@samturrell).</description>
    <link>https://dev.to/samturrell</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F60933%2Fab368049-e320-4a5a-ab38-2b37db472465.png</url>
      <title>DEV Community: Sam Turrell</title>
      <link>https://dev.to/samturrell</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/samturrell"/>
    <language>en</language>
    <item>
      <title>New package - Storybook Directories</title>
      <dc:creator>Sam Turrell</dc:creator>
      <pubDate>Wed, 29 Jan 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/samturrell/new-package-storybook-directories-3lnb</link>
      <guid>https://dev.to/samturrell/new-package-storybook-directories-3lnb</guid>
      <description>&lt;p&gt;If you haven’t heard of storybook, you’re missing out. We’re big fans of it at Netsells, and it has really helped us have clear visibility of what’s available to us when build our web apps. In a nutshell, Storybook gives you an isolated sandbox environment in which you can code up your components outside of your main application. It has a variety of addons available, which allow you to influence your stories and test them with different data and situations. I highly recommend you check out the &lt;a href="https://storybook.js.org/"&gt;Official docs&lt;/a&gt; and give it a go.&lt;/p&gt;

&lt;p&gt;Organisation is key in your storybook, whether it’s only visible internally or is part of a public-facing component reference. Keeping your stories categorised will mean you’re able to find the components you’re looking for a lot easier, and ultimately save time.&lt;/p&gt;

&lt;p&gt;What also takes time is figuring out the structure you want, and updating multiple stories with the perfect structure that works for you. This is a lot of duplicate code, just for the sake of formatting.&lt;/p&gt;

&lt;p&gt;That’s why I built this package. This simple module solves this problem by allowing you to control the story structure right from the drag and drop UI of your file system, meaning no code updates are required.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add @netsells/storybook-directories
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;p&gt;Simply import the package into your storybook config, and update your &lt;code&gt;configure&lt;/code&gt; statement to pass in the &lt;code&gt;storybookDirectories&lt;/code&gt; function with a &lt;code&gt;stories&lt;/code&gt; parameter which matches your &lt;code&gt;require.context&lt;/code&gt; call.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import storybookDirectories from '@netsells/storybook-directories';

configure(
    storybookDirectories({
        stories: require.context('../stories', true, /\.stories\.js$/),
    }),
    module
);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Your stories now no longer need to specify a default export, although if you require it you can simply omit the &lt;code&gt;title&lt;/code&gt; property. However, if you wish to override the directory structure for a story you can do this by simply specifying a title as you would normally.&lt;/p&gt;

&lt;p&gt;Take the following directory structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;stories/
│
├─ 0. Welcome/
│ └─ Welcome.stories.js
│
├─ 1. UI/
│ ├─ Typography.stories.js
│ ├─ Buttons.stories.js
│ └─ Icons.stories.js
│
├── 2. Forms/
│ ├─ Inputs/
│ │ ├─ TextInput.stories.js
│ │ └─ CheckboxInput.test.js
│ └─ ContactForm.stories.js
│
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Would generate stories with titles in the following format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0. Welcome|Welcome
1. UI|Buttons
1. UI|Icons
1. UI|Typography
2. Forms|Inputs/TextInput
2. Forms|Inputs/CheckboxInput
2. Forms|ContactForm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This format matches the Storybook separator formats, and would generator a storybook with grouped sections matching your directory structure.&lt;/p&gt;

</description>
      <category>storybook</category>
      <category>package</category>
      <category>javascript</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Gitprefix - Automatically formatting commit messages</title>
      <dc:creator>Sam Turrell</dc:creator>
      <pubDate>Sun, 26 Jan 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/samturrell/gitprefix-automatically-formatting-commit-messages-272n</link>
      <guid>https://dev.to/samturrell/gitprefix-automatically-formatting-commit-messages-272n</guid>
      <description>&lt;p&gt;At work, part of our code standards means we are asked to prefix our branches and commits with the ID of the Jira issue we’re working on. This allows our Jira instance to hook into our activity on Github.&lt;/p&gt;

&lt;p&gt;When you’re working away on a few different issues, sometimes it’s easy to forget to add this to each commit. To combat this I had been using a git pre-commit hook to prepend the branch ID to each commit for years. When I updated my mac to Catalina last year I performed a fresh install and subsequently lost this script, so I decided to recreate it, with a few additions of my own.&lt;/p&gt;

&lt;p&gt;I believe the original script was written in bash, and was extremely difficult to build on if I ever wanted to. Being a primarily frontend developer, it made sense to write this in javascript, or more specifically node. After a bit of research and poking I managed to get it built in a fairly short amount of time, and have been using it ever since.&lt;/p&gt;

&lt;p&gt;Recently I was asked if it was available anywhere for anybody else to use, and obviously it wasn’t as I’d built it to solve a problem of my own. This weekend I decided to change this and packaged it up. Rather than just stick up a gist and let people manually add it to their templates, I decided a CLI was the best choice to handle the automatic installation and update.&lt;/p&gt;

&lt;p&gt;Introducing &lt;a href="https://www.npmjs.com/package/gitprefix"&gt;gitprefix&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Gitprefix does a couple of things. Firstly it covers the functionality of the original script I used, and parses the branch you’re on and prefixes the current commit message. A simple example of this would be, say you’re on a branch named &lt;code&gt;task/ABC-123&lt;/code&gt;, and ran the following command &lt;code&gt;git commit -m"Updated header text"&lt;/code&gt;, the actual commit message would be logged as &lt;code&gt;ABC-123 - Updated header text&lt;/code&gt; without any additional work from you.&lt;/p&gt;

&lt;p&gt;The second feature of this formatter is something I’d wanted to do for a while. I wanted to easily and visually distinguish the type of change in a commit via emoji’s, much like the &lt;a href="https://gitmoji.carloscuesta.me/"&gt;gitmoji&lt;/a&gt; project.&lt;/p&gt;

&lt;p&gt;Currently the formatter doesn’t handle all of the different types of changes, but does handle a number of them, as listed in the table below.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Emoji&lt;/th&gt;
&lt;th&gt;Text trigger&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;🔧&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fix&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fixing something&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🚧&lt;/td&gt;
&lt;td&gt;&lt;code&gt;wip&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Work in progress&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🐛&lt;/td&gt;
&lt;td&gt;&lt;code&gt;bug&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Related to a bug (often paired with fix)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🔨&lt;/td&gt;
&lt;td&gt;&lt;code&gt;refactor&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Performed a refactor&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;⏪&lt;/td&gt;
&lt;td&gt;&lt;code&gt;revert&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reverted a change&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;👌&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pr&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Changes based on PR comments&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🎉&lt;/td&gt;
&lt;td&gt;&lt;code&gt;initial commit&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Initial commit of the project&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;📱&lt;/td&gt;
&lt;td&gt;&lt;code&gt;responsive&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Responsive changes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;♿️&lt;/td&gt;
&lt;td&gt;&lt;code&gt;accessibility&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Accessibility updates&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The way this works is by finding the text trigger in the message of the commit and appending the relevant emoji. Nothing clever, but it gets the job done.&lt;/p&gt;

&lt;p&gt;The list is far from extensive, but does the job for now.&lt;/p&gt;

&lt;p&gt;You can install the formatter extremely easily by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx gitprefix install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If you’d like to contribute, you can check out the source code &lt;a href="https://github.com/samturrell/gitprefix"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>git</category>
      <category>emoji</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Automated Pull Request Checks on Github</title>
      <dc:creator>Sam Turrell</dc:creator>
      <pubDate>Mon, 26 Nov 2018 00:00:00 +0000</pubDate>
      <link>https://dev.to/samturrell/automated-pull-request-checks-on-github-2p0p</link>
      <guid>https://dev.to/samturrell/automated-pull-request-checks-on-github-2p0p</guid>
      <description>&lt;p&gt;There aren’t many jobs out there where you have the direct ability to make your day to day tasks more efficient. This is part of what makes being a developer so great. Problem solving is our jam. We can identify problems and simplify them or automate them entirely.&lt;/p&gt;

&lt;p&gt;As a lead, one of my duties is to approve and merged Pull Requests on GitHub. A task that can take long enough in itself (depending on the size of the PR) without the semi-frequent back and forth involved in making sure appropriate guidelines are followed. With the beta launch of &lt;a href="https://github.com/features/actions" rel="noopener noreferrer"&gt;GitHub Actions&lt;/a&gt; a couple of weeks ago, it seems like as good a time as any to start looking at this area and see how we can streamline this process.&lt;/p&gt;

&lt;p&gt;So, some of the problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Titles not following the correct format&lt;/li&gt;
&lt;li&gt;PR template not being adequately filled out&lt;/li&gt;
&lt;li&gt;Users not reviewing their own code before submitting&lt;/li&gt;
&lt;li&gt;Debug code left in&lt;/li&gt;
&lt;li&gt;Make sure WIP branches cannot be merged&lt;/li&gt;
&lt;li&gt;Etc, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Don’t get me wrong, these things don’t happen all the time, but all of these can be automated out of existence before we even come to check the PR. This means that merges are not needlessly delayed, and our Project Managers don’t get twitchy. So how do we do that? Well, if you’ve ever used Travis or similar CI tooling you’ve probably seen how “Checks” are used to prevent PRs being merged until the test suite has passed or the assets have been built. Seems to be the perfect functionality for most of our problems.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsamturrell.github.io%2Fimages%2Fgithub-travis-checks.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsamturrell.github.io%2Fimages%2Fgithub-travis-checks.png" alt="Travis CI Checks on Github"&gt;&lt;/a&gt;Travis CI Checks on Github&lt;/p&gt;

&lt;p&gt;The handy GitHub REST API allows us to achieve everything we need here, and even better than manually calling multiple endpoints there is an entire framework for building GitHub apps to install your integrations across your entire organisation. Check out the docs for &lt;a href="https://probot.github.io/" rel="noopener noreferrer"&gt;Probot&lt;/a&gt; if you’re interested in building one yourself.&lt;/p&gt;

&lt;p&gt;As it was my first time using Probot I decided to start with a simple one: PR Titles. There are only two things required in a title. The Jira task identifier and a short description of the changes.&lt;/p&gt;

&lt;p&gt;The plan:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When a PR is created we’ll run a check

&lt;ul&gt;
&lt;li&gt;Webhook via Probot ✅&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Check that the title matches the format

&lt;ul&gt;
&lt;li&gt;JavaScript logic ✅&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;If the check fails leave a comment on the PR for the user to fix

&lt;ul&gt;
&lt;li&gt;GitHub API via Probot ✅&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;When the PR is updated we’ll check again

&lt;ul&gt;
&lt;li&gt;Rinse and repeat ♽&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Probot was incredibly straight forward to use and within a few hours I had the had completed the app, with a full test suite on all possible title variants using jest and nock (again, Probot made this almost effortless).&lt;/p&gt;

&lt;p&gt;Deployment of your bots is documented as being incredibly simple, but in my experience it was a bit of a pain. However I put this down to never having used now.sh before and a recent major bump in their version that didn’t play too well with the setup. I downgraded to the earlier major and it was a lot more pleasant.&lt;/p&gt;

&lt;p&gt;There’s still some work to be done to iron out the kinks, but this initial app makes me excited to expand on our automation in this area. Hopefully we can build up a comprehensive suite of checks to make everything run just that little bit smoother.&lt;/p&gt;

&lt;p&gt;If you’d like to check out the code for the App, you can do so &lt;a href="https://github.com/netsells/probot-pr-title-check" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>github</category>
      <category>git</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Maximising Productivity with Slack</title>
      <dc:creator>Sam Turrell</dc:creator>
      <pubDate>Mon, 05 Mar 2018 00:00:00 +0000</pubDate>
      <link>https://dev.to/samturrell/maximising-productivity-with-slack--e89</link>
      <guid>https://dev.to/samturrell/maximising-productivity-with-slack--e89</guid>
      <description>&lt;p&gt;In the development sphere you probably use Slack pretty heavily in your general day to day activities. It’s an extremely helpful form of communication and its use can vary from discussing work matters to sending hilarious gifs. So there can be a high rate of messages throughout the day.&lt;/p&gt;

&lt;p&gt;On a single small team this isn’t so bad, but if you’re part of multiple workspaces with large teams, you may find it becomes quick a hindrance and distraction with the constant notifications and unrelated chit chat you might not necessarily care about.&lt;/p&gt;

&lt;p&gt;Here are a handful of tips to improve your slack usage to make you more productive through the day.&lt;/p&gt;

&lt;h2&gt;
  
  
  Silence Noisy Channels
&lt;/h2&gt;

&lt;p&gt;Are you in channels that you’re not necessarily a part of, but need to be on hand if required? Maybe you have automated build/deployment tools that message specific channels on success, and not much else. Try and silence these channels using the &lt;code&gt;/mute&lt;/code&gt; command. This will grey out the channel in your channel list and suppress any and all notifications, even mentions. If you are mentioned, you’ll get the standard notification number on the channel in the sidebar but you won’t be notified.&lt;/p&gt;

&lt;h2&gt;
  
  
  Set Notification Preferences
&lt;/h2&gt;

&lt;p&gt;Slack is extremely useful, but there can be many messages throughout the day, most of which -are gifs- probably aren’t too important. Slack unfortunately sends notifications for all of these regardless of whether you were mentioned or not.&lt;/p&gt;

&lt;p&gt;But there is a solution! The notification preferences! Slack provides three main settings here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All new messages - you’ll be notified of all new messages&lt;/li&gt;
&lt;li&gt;Direct messages, mentions &amp;amp; keywords - you’ll be notified when a teammate mentions you, sends you a direct message or uses one of your keywords&lt;/li&gt;
&lt;li&gt;Nothing - you won’t receive notifications from Slack&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want full radio silence, the last option is what you want, but in most cases this is probably overkill. You’ll usually just want to filter out all non-direct chaff, and that’s the second option.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DMIFMFIl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://samturrell.github.io/images/slack-notifications.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DMIFMFIl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://samturrell.github.io/images/slack-notifications.png" alt="Slack Notifications"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Set Yourself to ‘Do Not Disturb’
&lt;/h2&gt;

&lt;p&gt;If you’re particularly busy, working on an infuriating issue, or generally just want people to leave you alone, you can set yourself to “Do Not Disturb”. This has the added benefit of showing other members of the team that you would prefer not to be distracted at this time.&lt;/p&gt;

&lt;p&gt;Simply type &lt;code&gt;/dnd&lt;/code&gt; into slack and you’ll be able to toggle your Do Not Disturb status on and off. Or provide a description of time and Slack will automatically remove your DND status when the period ends.&lt;/p&gt;

&lt;p&gt;You can also specify an automatic do not disturb period in the notifications preference.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--k13ID-Ci--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://samturrell.github.io/images/slack-dnd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k13ID-Ci--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://samturrell.github.io/images/slack-dnd.png" alt="Slack Do Not Disturb"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Reserve Time for Catching Up
&lt;/h2&gt;

&lt;p&gt;Try to contain your Slack usage to specific moments throughout the day to catch up on what you may have missed. Maybe when you find yourself transitioning to a new bit of work, or you find yourself struggling with a troublesome bit of logic and need to give your mind a rest. This way you’re not constantly being pulled out of the coding mindset by checking every message, and can concentrate on solving the real issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  Starred Channels
&lt;/h2&gt;

&lt;p&gt;Separate the important form the noise. Star individual channels and direct messages to separate them from your main list of channels in the sidebar. This makes it easier to see the channels that matter most.&lt;/p&gt;

&lt;h2&gt;
  
  
  Group Unread Messages
&lt;/h2&gt;

&lt;p&gt;Slack provides a handy way for you to catch up on your unread messages within a single list view. You’ll need to enable this in the settings of your workspace under the “sidebar” section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SYzbKNmV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://samturrell.github.io/images/slack-group-unreads.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SYzbKNmV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://samturrell.github.io/images/slack-group-unreads.png" alt="Slack Group Unreads"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can choose how you want to sort messages with the options of Alphabetically, Oldest First, Newest First, or leave it up to Slacks magic algorithms with the “Scientifically” option. I don’t know what that means, but it sounds cool, eh?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OWzwH39q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://samturrell.github.io/images/slack-scientific-sort.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OWzwH39q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://samturrell.github.io/images/slack-scientific-sort.png" alt="Slack Scientific Sort"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Mark Messages as Read
&lt;/h2&gt;

&lt;p&gt;If you’ve been away for a while and haven’t been explicitly notified via a mention/highlight, why not just clear all unread messages for a single channel or all channels? With the handy keyboard shortcuts provided, you can quickly clear unreads at the press of a button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CylenGRj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://samturrell.github.io/images/slack-shortcuts.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CylenGRj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://samturrell.github.io/images/slack-shortcuts.png" alt="Slack Shortcuts"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Threads
&lt;/h2&gt;

&lt;p&gt;Try and get into the habit of using threads for responding to messages. This allows you to keep an eye on specific discussions, and will reduce the amount of noise in general for the entire team. A win-win!&lt;/p&gt;

&lt;h2&gt;
  
  
  Defer Actionable
&lt;/h2&gt;

&lt;p&gt;Sometimes you may be asked to do things, but you don’t have time to jump off what you’re currently doing to handle it. In these instances, you can simply get slack to remind you at a more convenient time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I8a62KHR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://samturrell.github.io/images/slack-remind.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I8a62KHR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://samturrell.github.io/images/slack-remind.png" alt="Slack Message Reminders"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Most of the preferences mentioned above are defined on a per-workspace basis, so if you’re part of multiple teams you may want to go through and apply these settings to each active workspace.&lt;/p&gt;

&lt;p&gt;I use quite a lot of the above on a regular basis, and it really does help. They allow me to concentrate on what’s important and filter out the general noise of multiple channels and workspaces.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>slack</category>
    </item>
    <item>
      <title>Stop with the unhelpful loading spinners</title>
      <dc:creator>Sam Turrell</dc:creator>
      <pubDate>Sat, 03 Feb 2018 00:00:00 +0000</pubDate>
      <link>https://dev.to/samturrell/stop-with-the-unhelpful-loading-spinners--ce9</link>
      <guid>https://dev.to/samturrell/stop-with-the-unhelpful-loading-spinners--ce9</guid>
      <description>&lt;p&gt;I get a train to work every day and have recently renewed my season ticket for a new e-ticket directly on my phone. I no longer have to carry around a ticket wallet, I just flash my phone when needed. Very convenient. However, when the ticket man comes by I load up the TPExpress app, go to my tickets and BOOM, get hit with a loading spinner as the ticket man looms over me impatiently waiting. It usually loads for ~5 seconds - but why? What is it doing? The ticket can be used offline, what on earth is it checking for? And why does it take so long?&lt;/p&gt;

&lt;p&gt;The problem here isn’t so much the wait. It’s the lack of feedback to the user of what’s going on. I see it a lot in apps and on websites that just hang on loading screens when you open them or when you perform some kind of action such as on a form or checkout process.&lt;/p&gt;

&lt;p&gt;What I like to do is actually inform the user of what’s going on and avoid unhelpful loading spinners at all costs. This is especially handy for multi-step processes such as payment forms where you might have to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;reserve the items&lt;/li&gt;
&lt;li&gt;create a user&lt;/li&gt;
&lt;li&gt;create a new card&lt;/li&gt;
&lt;li&gt;create a payment token with stripe&lt;/li&gt;
&lt;li&gt;and finally send the payment request to the backend to handle&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each of these steps are an API call that take time to complete. If you simply show the same “loading” indicator for all of these steps, it just looks like your platform is extremely slow. The user isn’t aware of that multi step process. If these APIs are somewhat slow, a slightly impatient user might even exit out or refresh because they think it’s broken.&lt;/p&gt;

&lt;p&gt;It something in that process fails, it’s also less indicative of &lt;em&gt;where&lt;/em&gt; it failed. You’ll thank yourself when you’re sent screenshots from QA/users with the specific text of the step it’s hanging on.&lt;/p&gt;

&lt;p&gt;I’m not saying you have to tell the user exactly what’s happening at each step, but give some kind of indication to the user of why things are taking so long to load and that something is actually happening. Your process will feel a lot more responsive and users (me) will be a lot happier.&lt;/p&gt;

</description>
      <category>ux</category>
      <category>loaders</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Responsive Blocks and Vertical Alignment</title>
      <dc:creator>Sam Turrell</dc:creator>
      <pubDate>Thu, 11 Jan 2018 00:00:00 +0000</pubDate>
      <link>https://dev.to/samturrell/responsive-blocks-and-vertical-alignment-3jb</link>
      <guid>https://dev.to/samturrell/responsive-blocks-and-vertical-alignment-3jb</guid>
      <description>&lt;p&gt;Today I’m going to show you two of my favourite CSS “hacks.” Responsive height blocks, and vertical alignment. These two often go hand in hand, usually with some sort grid of blocks with text in the centre. I’m sure you’ve come across the pattern before.&lt;/p&gt;

&lt;h2&gt;
  
  
  Responsive blocks
&lt;/h2&gt;

&lt;p&gt;First up, responsive blocks. We’ve all used responsive width columns, but you’ve probably never used responsive heights. If you apply &lt;code&gt;height: 50%;&lt;/code&gt; to an element, you’re not going to see any results. Unlike width, height cannot be set as a percentage as block container elements do not not have a height, whereas they do default to 100% width.&lt;/p&gt;

&lt;p&gt;We can, however, make the height relative to the width. To do so, we will be making use of the &lt;code&gt;padding&lt;/code&gt; rule. If you apply the rule of &lt;code&gt;padding-bottom: 100%;&lt;/code&gt; to a div, you will end up with a perfect square. However, a full page square isn’t exactly helpful is it. We want a grid of squares. You may think this is easy to a accomplish by setting a width on this div and watching it scale, however that is not the case. The padding is actually relative to the &lt;strong&gt;parent&lt;/strong&gt; element, &lt;em&gt;not&lt;/em&gt; the element with the rule applied.&lt;/p&gt;

&lt;p&gt;So to make box smaller and responsively sized, we just need a container element with a width value. This is usually fine as it’s probably within a grid column anyway. Now you just tell the child how big it should be relative to the parent and there you have a perfect responsive height square.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div style="margin: 0 -10px;" class="clearfix"&amp;gt;
    &amp;lt;div style="width: 25%; float: left; padding: 0 10px;"&amp;gt;
        &amp;lt;div class="primary" style="padding-bottom: 100%;"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    ...
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You can of course do responsive rectangles by following the pattern and just adjusting the padding percentage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Vertical Alignment
&lt;/h2&gt;

&lt;p&gt;Ah, vertical alignment, the bane of frontend developers lives. However it doesn’t have to be. Depending on usage, you can follow a simple pattern to achieve vertical alignment that works extremely well with the above responsive blocks tip.&lt;/p&gt;

&lt;p&gt;You’ll probably shudder at the thought, but we’re going to be using tables! Well, not exactly tables. Fake tables. Tables have the awesome ability of being able to make use of the &lt;code&gt;vertical-align&lt;/code&gt; CSS rule for aligning content, and with the use of &lt;code&gt;display: table;&lt;/code&gt; and &lt;code&gt;display: table-cell;&lt;/code&gt; we can actually take advantage of this functionality with standard divs.&lt;/p&gt;

&lt;p&gt;All you need is a div with &lt;code&gt;display: table;&lt;/code&gt; and within it, a div with &lt;code&gt;display: table-cell;&lt;/code&gt; and &lt;code&gt;vertical-align: middle;&lt;/code&gt;. Just give the parent div a height and you’ll have perfectly entered content.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="playground"&amp;gt;
    &amp;lt;div class="primary" style="display: table; height: 100px; max-width: 100%; width: 100%; text-align: center;"&amp;gt;
        &amp;lt;div style="display: table-cell; vertical-align: middle; padding: 15px;"&amp;gt;
            Look at me being all vertically aligned!
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Some may argue flexbox can solve this problem in much less lines of code, however table-cell is supported in every browser for a worry free dev experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  The double whammy
&lt;/h2&gt;

&lt;p&gt;Combining with the above is simple. If you try to put your faux-table inside the responsive block however, you’ll end up with a no longer reliably responsive block. This is because of the height from the padding trick combined with the height of your table. Instead we’ll need to add another container block within the responsive block.&lt;/p&gt;

&lt;p&gt;Simply set &lt;code&gt;position: relative;&lt;/code&gt; on the block with the padding, and add a new div within this with &lt;code&gt;position: absolute; top: 0; right: 0; bottom: 0; left: 0;&lt;/code&gt; which will make this div the same size as the parent which allow you to add content to the block.&lt;/p&gt;

&lt;p&gt;This block also now has a fixed height, so you can now used a percentage height value for your content. Simply add your vertical aligned block to this div and give it a 100% height and width and you’ll have perfectly aligned content within your block.&lt;/p&gt;

&lt;p&gt;Check out the &lt;a href="https://samturrell.github.io/2018/01/11/responsive-blocks-and-vertical-alignment/"&gt;original post&lt;/a&gt; to see these examples in action.&lt;/p&gt;

</description>
      <category>css</category>
      <category>hacks</category>
      <category>verticalalign</category>
    </item>
  </channel>
</rss>
