]> _ Git - pmi.git/commitdiff
WIP #2731 @7.5
authorStephen Cameron <stephen@cubedesigners.com>
Wed, 22 May 2019 17:18:43 +0000 (19:18 +0200)
committerStephen Cameron <stephen@cubedesigners.com>
Wed, 22 May 2019 17:18:43 +0000 (19:18 +0200)
16 files changed:
resources/styles/app.styl
resources/styles/common/debug.styl
resources/styles/common/global.styl
resources/styles/common/headings.styl [new file with mode: 0644]
resources/styles/common/links.styl [new file with mode: 0644]
resources/styles/common/mixins.styl
resources/styles/common/setup.styl
resources/styles/common/spacing.styl [new file with mode: 0644]
resources/styles/components/buttons.styl [new file with mode: 0644]
resources/views/layouts/app.blade.php
resources/views/pages/home.blade.php
resources/views/partials/footer.blade.php
resources/views/partials/header.blade.php
resources/views/partials/logo.blade.php
tailwind.config.js
webpack.mix.js

index 8fa74ebc64af344301ee6431dbc8def9e7270b7e..4a843cc35fa09b932d93295a1b3e698c6b279027 100644 (file)
@@ -7,7 +7,12 @@
 @tailwind components
 
 // Extracted components or custom styles that can't be done with utilities
+@import 'common/spacing'
 @import 'common/global'
+@import 'common/headings'
+@import 'common/links'
+
+@import 'components/*'
 
 // Utilities go last in source order so they can
 // override other classes with the same specificity
index a43e06db79d082d3ceb82abe1b6a6f2501d9b4d3..e6b1dbaedf20f1671eeddc9701b3c6ad6931eebd 100644 (file)
@@ -1,6 +1,6 @@
 // Debugging styles
 
-if ($debug)
+if ($debug.overlays)
 
   //:root
   //  --debug-container-overlay: theme('colors.blue.500')
@@ -9,12 +9,13 @@ if ($debug)
   html, body
     &:before
       z-index: 20 !important // Put overlays above header
+      opacity: 0.2 !important
 
   html
-    lost-utility: overlay ($content-max-width) 1 10px theme('colors.green.300');
+    lost-utility: overlay ($content-max-width) 1 10px theme('colors.green.700');
 
   body
-    lost-utility: overlay ($base-width * 0.8) 1 2px theme('colors.blue.600');
+    lost-utility: overlay ($base-width * 0.8) 1 2px theme('colors.blue.300');
 
     // Centre line
     &:after
@@ -28,7 +29,7 @@ if ($debug)
       z-index: 100
 
 
-if ($debug > 1)
+if ($debug.outlines)
 
   *:not(path):not(g):not(rect) // Outline all elements without affecting position or size
     outline: 1px dotted red !important
index a13c0517d964e35d89988c90b3eacee49cbce728..95d1dba0d8d7166d0cb72b84395eb7b823e3f1b2 100644 (file)
@@ -1,14 +1,26 @@
 // PMI Global Styles
 
-a
-  @apply text-blue
-
-  &:hover
-    @apply underline
-
+p:not(:last-child)
+  margin-bottom: 1.5em
 
 // Layout containers
 .container
   center($content-max-width)
   horizontal-spacing($horizontal-gutter)
   width: 100%
+
+// Overlapping content
+.overlap
+  &-left
+
+    // Todo: only apply this above the columns breakpoint
+    //+above($breakpoint-columns)
+
+    position: relative
+    constrain(left, -10vw)
+
+    // Todo: decide if width should be increased by default or if this should be in an extra class? eg. .overlap-left-stretch?
+    //width: calc(100% + 10vw)
+    //
+    //+above($base-width)
+    //  width: s('calc(100% + %s)', $base-width * 0.1)
diff --git a/resources/styles/common/headings.styl b/resources/styles/common/headings.styl
new file mode 100644 (file)
index 0000000..1dd524f
--- /dev/null
@@ -0,0 +1,23 @@
+// Headings
+h1, h2, h3, h4
+  line-height: 1.2
+  @apply text-navy font-display font-semibold
+
+.h1
+  @apply text-6xl leading-tight relative
+
+  &:after
+    content: ''
+    display: block
+    constrain(margin-top, 1vw)
+    constrain(margin-bottom, 2.5vw)
+    constrain(width, 10vw)
+    height: 8px
+    background-color: theme('colors.blue')
+
+  +below(1420px)
+    @apply text-5xl
+  +below(1000px)
+    @apply text-4xl
+
+
diff --git a/resources/styles/common/links.styl b/resources/styles/common/links.styl
new file mode 100644 (file)
index 0000000..e882247
--- /dev/null
@@ -0,0 +1,29 @@
+// Link styles
+
+a
+  @apply text-blue
+
+  // Don't apply if 'no-animation' class is set
+  &:not(.btn):not(.no-animation)
+    position: relative
+    padding-bottom: 2px
+
+    // Only apply to <main> content
+    main &
+
+      &:before
+        content: ''
+        display: block
+        position: absolute
+        bottom: 0
+        left: 0
+        width: 100%
+        height: 2px
+        background-color: currentColor
+        transform: scaleX(0)
+        transform-origin: left
+        transition: transform 0.2s ease-out
+
+      &:hover
+        &:before
+          transform: scaleX(1)
index 55cd5f940c07355fff6a5e35099f103011d563ff..7f59d6b93cc7b874025fbf951b29f0eac7d4e334 100644 (file)
@@ -9,7 +9,7 @@ constrain(property, value = $horizontal-gutter, max-width = $base-width) {
     // Only do this if we are dealing with a percentage or vw unit
     if (unit(value) is '%' || unit(value) is 'vw') {
       $max = max-width * unit(value / 100, '') // Convert percentage to a decimal
-      {property}: $max
+      {property}: round($max)
     }
   }
 
@@ -18,7 +18,7 @@ constrain(property, value = $horizontal-gutter, max-width = $base-width) {
     // Only do this if we are dealing with a percentage or vw unit
     if (unit(value) is '%' || unit(value) is 'vw') {
       $min = 700px * unit(value / 100, '') // Convert percentage to a decimal
-      {property}: $min
+      {property}: round($min)
     }
   }
 }
@@ -26,18 +26,18 @@ constrain(property, value = $horizontal-gutter, max-width = $base-width) {
 
 // Apply percentage based vertical padding - defaults to global gutter value if nothing passed
 // Note: fractional vertical padding is based on width
-vertical-spacing(amount = $vertical-gutter)
-  constrain(padding-top, amount)
-  constrain(padding-bottom, amount)
-//padding-top: amount
-//padding-bottom: amount
+// Passing 'margin' as second parameter does margins instead
+vertical-spacing(amount = $vertical-gutter, property = 'padding')
+  constrain(s('%s-top', unquote(property)), amount)
+  constrain(s('%s-bottom', unquote(property)), amount)
 
 //---------------------------------------//
 
 // Apply percentage based vertical padding - defaults to global gutter value if nothing passed
-horizontal-spacing(amount = $horizontal-gutter)
-  constrain(padding-left, amount)
-  constrain(padding-right, amount)
+// Passing 'margin' as second parameter does margins instead
+horizontal-spacing(amount = $horizontal-gutter, property = 'padding')
+  constrain(s('%s-left', unquote(property)), amount)
+  constrain(s('%s-right', unquote(property)), amount)
 
 //---------------------------------------//
 
index 0a3260d2d1442e88bb8cb5089755cc53bdad1f36..40ec7efc765c47782c02ce1ce294b26de289c147 100644 (file)
@@ -1,5 +1,9 @@
 // General Setup
-$debug             = 0
+$debug = {
+  overlays: false,
+  outlines: false,
+}
+
 $base-width        = 1920px // Basis for vw unit calculations on large screens
 $content-max-width = $base-width * 0.9 // Allows 5% either side
 
diff --git a/resources/styles/common/spacing.styl b/resources/styles/common/spacing.styl
new file mode 100644 (file)
index 0000000..ccec2fa
--- /dev/null
@@ -0,0 +1,55 @@
+// Build utility classes for padding/margin based on vw units
+// This will generate classes like pt-1v, pt-2v, pr-1v etc.
+
+$vw-spacing = {
+  '1': 2.5vw,
+  '2': 5vw,
+  '3': 7.5vw,
+  '4': 10vw,
+  '5': 12.5vw,
+}
+
+$sides = {
+  t: top,
+  r: right,
+  b: bottom,
+  l: left,
+  x: horizontal, // special case for both left & right padding
+  y: vertical, // special case for both top & bottom padding
+}
+
+for sideAbbreviation, side in $sides
+  for counter, vwAmount in $vw-spacing
+
+    // Padding utilities (pt, pr, pb, pl, px, py)
+    .p{sideAbbreviation}-{counter}v
+      $property = s('padding-%s', side)
+
+      if (side is 'horizontal')
+        horizontal-spacing(vwAmount)
+      else if (side is 'vertical')
+        vertical-spacing(vwAmount)
+      else
+        constrain($property, vwAmount)
+
+    // Margin utilities (mt, mr, mb, ml, mx, my)
+    .m{sideAbbreviation}-{counter}v
+      $property = s('margin-%s', side)
+
+      if (side is 'horizontal')
+        horizontal-spacing(vwAmount, 'margin')
+      else if (side is 'vertical')
+        vertical-spacing(vwAmount, 'margin')
+      else
+        constrain($property, vwAmount)
+
+    // Negative margin utilities (-mt, -mr, -mb, -ml, -mx, -my)
+    .-m{sideAbbreviation}-{counter}v
+      $property = s('margin-%s', side)
+
+      if (side is 'horizontal')
+        horizontal-spacing( - vwAmount, 'margin')
+      else if (side is 'vertical')
+        vertical-spacing( - vwAmount, 'margin')
+      else
+        constrain($property, - vwAmount)
diff --git a/resources/styles/components/buttons.styl b/resources/styles/components/buttons.styl
new file mode 100644 (file)
index 0000000..61586dc
--- /dev/null
@@ -0,0 +1,4 @@
+// Buttons
+
+.btn
+  @apply bg-blue text-white px-10 py-4 relative
index 425984e7b7d749c92157e465527b6203af78a53f..b50a4eddec034f821edb476f190e7ac1515bb930 100644 (file)
@@ -1,15 +1,16 @@
 @include('cubist::head.htmldeclaration')
 <head>
     {{--@include('cubist::head.head')--}}
-    <link href="{{ asset('css/app.css') }}" rel="stylesheet">
+    <link href="{{ mix('css/app.css') }}" rel="stylesheet">
+    <link href="https://fonts.googleapis.com/css?family=Barlow:500,600|Muli&display=swap" rel="stylesheet">
 </head>
-<body>
+<body class="font-body text-grey-dark">
 @include('cubist::body.begin')
 
 <div class="flex flex-col min-h-screen">
     @include('partials.header')
 
-    <main class="container flex-grow">
+    <main class="flex-grow">
         @yield('content')
     </main>
 
index 1d78e6b4b627280d32a03bdf0d2455488e562f17..3f7155514c2cc78b7e435848571cf141274d32f7 100644 (file)
@@ -2,7 +2,41 @@
 
 @section('content')
 
-    <h1>Home</h1>
-    This is a <a href="#">link</a>.
+    {{-- Slider --}}
+    <div class="bg-navy pt-1v text-white antialiased">
+        <div class="container flex -mb32">
+            <div class="w-1/2 pt-2v pr-1v pb-2v pl-2v">
+                <h1 class="h1 text-inherit">Wheel Force Transducer</h1>
+                <p>
+                    Wheel Force Transducers (WFT) are used for measuring all wheel forces and moments. Field and laboratory test of passenger cars, light duty trucks, heavy duty trucks, vans, SUVs, class 8 trucks, heavy duty construction and farm equipment.
+                </p>
+
+                <p><a href="#" class="btn">Découvrir</a></p>
+
+                <div class="pb-2v"></div>
+
+            </div>
+            <div class="w-1/2 -mb-2v z-10 bg-cover" style="background-image:url({{ asset('images/home-car.jpg') }})"></div>
+        </div>
+    </div>
+
+    <div class="container flex pt-5v pb-4v">
+        <div class="w-1/2">
+            <img src="{{ asset('images/home-wing.jpg') }}" alt="">
+        </div>
+        <div class="w-1/2 pl-2v">
+            <h2 class="h1 overlap-left pt-2v">
+                Expert de la mesure
+                depuis plus de 30 ans
+            </h2>
+
+            <p>PM instrumentation distribue depuis 1986 des Capteurs et Systèmes de haute technicité. Issue de la société Schaevitz, PM Instrumentation a su développer une gamme de capteurs et systèmes d’excellente qualité provenant principalement des Etats-Unis.</p>
+
+            <p>Principalement dédiés aux mesures physiques, nous saurons vous conseiller dans le choix de produits adaptés à votre environnement.</p>
+
+            <p><a href="#">En savoir plus</a></p>
+
+        </div>
+    </div>
 
 @endsection
index 52559e324ab494ba400e6251fc01f30dd61652eb..2c3f9f97617ef0c3cddbacb9801099f52654a957 100644 (file)
@@ -1,4 +1,4 @@
-<footer class="bg-navy text-white">
+<footer class="bg-navy text-white font-display font-medium antialiased">
     <div class="container py-20 flex justify-between">
         @include('partials.logo')
         <span>This is the footer</span>
index a79bf1cb4bf827b8d99df8194cbb2a840782487b..bddd4595986d100d662d48dab950b6de0c6dc41a 100644 (file)
@@ -1,4 +1,4 @@
-<header class="bg-navy text-white">
+<header class="bg-navy text-white font-display font-medium antialiased">
     <div class="container flex items-center py-8">
         @include('partials.logo')
         @include('partials.nav')
index ea7be7d092ece14d0dc47b46fb1605b2d07784cc..af1252fae2c62d6d4fdb8bfa5946b5553496d607 100644 (file)
@@ -1 +1,3 @@
-<img src="{{ asset('images/pmi-logo.svg') }}">
+<a href="/">
+    <img src="{{ asset('images/pmi-logo.svg') }}" alt="PM Instrumentation logo">
+</a>
index da75c3ed7fd62bcd7bd9134bfd2c8ef89051df28..16506e8eab61f21ea2d398c4539cb518905a38de 100644 (file)
@@ -10,9 +10,16 @@ module.exports = {
           '100': '#F7F8FC',
           '200': '#EEF1F8',
           'dark': '#6B7287',
-        },
-      }
-    }
+        }
+      },
+      fontSize: {
+        '6xl': '3.75rem' // Only override this value
+      },
+      fontFamily: {
+        'display': ['Barlow', 'sans-serif'], // Headings, labels, menus etc
+        'body': ['Muli', 'sans-serif'], // Main blocks of text
+      },
+    },
   },
   variants: {},
   plugins: [],
index 877a3d8c747d63724ea8be9f3e2eb5aa45e066ce..04c0105b62415d90211c4fc26175e0e54f5f74fe 100644 (file)
@@ -13,6 +13,11 @@ require('laravel-mix-purgecss');
  |
  */
 
+mix.browserSync({
+  proxy: process.env.APP_URL,
+  open: false // Don't automatically open a new tab when the watcher starts
+});
+
 mix.js('resources/js/app.js', 'public/js')
    .stylus('resources/styles/app.styl', 'public/css', {
         use: [
@@ -26,7 +31,7 @@ mix.js('resources/js/app.js', 'public/js')
     })
     .purgeCss();
 
-mix.browserSync({
-  proxy: process.env.APP_URL,
-  open: false // Don't automatically open a new tab when the watcher starts
-});
+// Enable unique hashed filenames when in production
+if (mix.inProduction()) {
+  mix.version();
+}