JSFiddle - React, Tailwind, and code Playground

by Sahil Kashyap

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="container">
  <div class="item" style="left: 185px; top: 85px;">Marketing</div>
  <div class="item" style="left: 135px; top: 172px;">campaign</div>
  <div class="item" style="left: 35px; top: 172px;">Analytics</div>
  <div class="item" style="left: -15px; top: 85px;">4</div>
  <div class="item" style="left: 35px; top: -2px;">5</div>
  <div class="item" style="left: 135px; top: -2px;">6</div>
</div>

CSS

body:after {
  visibility: hidden;
  height: 0;
  font-size: 0;
}
/* Mobile Styles */
@media only screen and (max-width: 400px) {
  body {
    background-color: #F09A9D; /* Red */
  }
   body:after {
    content: "mobile";
  }
  
  #container {
  width: 100px;
  height: 100px;
  margin: 10px auto;
  border: 1px solid #000;
  position: relative;
  border-radius: 50%;
  animation: spin 10s linear infinite;
}
.item {
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  border-radius: 50%;
  position: absolute;
  background: #f00;
  animation: spin 10s linear infinite reverse;
}
@keyframes spin {
  100% {
    transform: rotate(1turn);
  }
}

}

/* Tablet Styles */
@media only screen and (min-width: 401px) and (max-width: 960px) { 
body:after {
    content: "tablet";
  }
  body {
    background-color: #F5CF8E; /* Yellow */
  }
  #container {
  width: 200px;
  height: 200px;
  margin: 10px auto;
  border: 1px solid #000;
  position: relative;
  border-radius: 50%;
  animation: spin 10s linear infinite;
}
.item {
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  border-radius: 50%;
  position: absolute;
  background: #f00;
  animation: spin 10s linear infinite reverse;
}
@keyframes spin {
  100% {
    transform: rotate(1turn);
  }
}

}

/* Desktop Styles */
@media only screen and (min-width: 961px) {              
body:after {
    content: "desktop";
  }
  body {
    background-color: #B2D6FF; /* Blue */
  }
  #container {
  width: 400px;
  height: 400px;
  margin: 10px auto;
  border: 1px solid #000;
  position: relative;
  border-radius: 50%;
  animation: spin 10s linear infinite;
}
.item {
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  border-radius: 50%;
  position: absolute;
  background: #f00;
  animation: spin 10s linear infinite reverse;
}
@keyframes spin {
  100% {
    transform: rotate(1turn);
  }
}


}

JavaScript

var breakpoint = window.getComputedStyle(document.querySelector('body'), ':after').getPropertyValue('content').replace(/"/g,'');
$(window).resize(function() {
if (window.matchMedia('(max-width: 400px)').matches)  {
// functionality for  mobile
    var radius = 50;
    
var fields = $('.item'),
  container = $('#container'),
  width = container.width(),
  height = container.height();
var angle = 0,
  step = (2 * Math.PI) / fields.length;
fields.each(function() {
  var x = Math.round(width / 2 + radius * Math.cos(angle) - $(this).width() / 2);
  var y = Math.round(height / 2 + radius * Math.sin(angle) - $(this).height() / 2);
  if (window.console) {
    console.log($(this).text(), x, y);
  }
  $(this).css({
    left: x + 'px',
    top: y + 'px'
  });
  angle += step;
});
    
}
if (window.matchMedia('(min-width: 401px)').matches) 
{// functionality for tablet
var radius = 100;

var fields = $('.item'),
  container = $('#container'),
  width = container.width(),
  height = container.height();
var angle = 0,
  step = (2 * Math.PI) / fields.length;
fields.each(function() {
  var x = Math.round(width / 2 + radius * Math.cos(angle) - $(this).width() / 2);
  var y = Math.round(height / 2 + radius * Math.sin(angle) - $(this).height() / 2);
  if (window.console) {
    console.log($(this).text(), x, y);
  }
  $(this).css({
    left: x + 'px',
    top: y + 'px'
  });
  angle += step;
});}
if (window.matchMedia('(min-width: 961px)').matches){
// functionality for  desktop
        
var radius = 200;

var fields = $('.item'),
  container = $('#container'),
  width = container.width(),
  height = container.height();
var angle = 0,
  step = (2 * Math.PI) / fields.length;
fields.each(function() {
  var x = Math.round(width / 2 + radius * Math.cos(angle) - $(this).width() / 2);
  var y = Math.round(height / 2 + radius * Math.sin(angle) - $(this).height() / 2);
  if (window.console) {
    console.log($(this).text(), x, y);
  }
  $(this).css({
    left: x + 'px',
    top: y + 'px'
 ...