Platform Contributor Guide
[Legacy v3] Platform
[Legacy v3] Platform
  • 👋[Legacy v3] Welcome | README
  • Contributing | Getting Involved
    • Specific tasks needed for COVID19-support
    • Add code to Ushahidi
    • Encouraging contribution from non-developers
  • Frequently Asked Questions
  • Join the Ushahidi community
  • Contributors ✨
  • 🛣️ The Ushahidi Platform Roadmap
    • V2-V3+ Migration tool
  • Privacy and security best practices
    • Security as a user
    • Security for deployment admins
    • Security for deployment hosts
  • Development & Code
    • Development: Overview
    • How to get the source code
    • Setup Guides
      • Installing for production environments
      • Development environment with XAMPP
      • Development environment setup with Vagrant
      • [Client] Setting up the Platform Client for development
        • Migration from AngularJS
      • Setting up the Pattern Library for development
      • [API & Client] Bundled release install
    • Add code to Ushahidi
    • Development process
    • Coding Standards
    • Track and submit issues in Github
    • Upgrading Ushahidi
      • Upgrading to latest release
      • Upgrading from V3.x.x to V4.x.x
    • ⚙️ Installation Helper‌
  • Tech Stack
    • API Documentation
    • Third party app development
      • Web hooks
    • Database | Tables overview
    • Database | Database Schema Diagram
    • Database | Table details
    • 📐Architecture
    • Use case internals
  • QA & Testing
    • The QA process
    • How to run QA tests
    • Defect Management
    • How to write QA test scripts
    • Hotfixes
  • Front-end development
    • Changing UI styles: introduction to the pattern library
      • File-structure
      • Installing new packages
      • How to Apply to the Platform
      • Using the changed styles in platform-client
      • Syntax and Formatting
      • Grid, Breakpoints, & Media Queries
      • Variables
      • Mixins
      • Helpers
      • Icons
      • Create a New Component from Scratch
      • Read Direction
  • Design
    • 🎨Design: overview
    • 'Best practice' design
    • Ushahidi Platform 'Sticker Sheet'
    • User testing process
    • User testing script examples
    • Synthesising user testing results examples
      • Synthesis example 1
      • Synthesis example 2
      • Synthesis example 3
      • Synthesis recommendations example 1
      • Synthesis recommendations example 2
    • Open Source Design
  • Documentation
    • Documentation
    • Contributing docs via GitHub
  • Translation
    • Localization and Translation
  • The Ushahidi Platform Facebook bot
    • The Facebook bot
      • Installing the bot
      • The bot script
  • Hackathon and events
    • Installathon, May 2019
      • Welcome to the hackathon!
    • Write/Speak/Code 2019
    • Open Design: Bangalore
    • Open Design: Taipei
    • 📑Google season of docs
    • 💻Google Summer of Code
      • GSoC 2024
  • Enhancement Proposals
    • Exchange Format
    • Importing data from previous versions
Powered by GitBook
On this page
  • LTR/RTL body class
  • Conflicts
  • Supported Properties
  • Example
  • Background & Background Position
  • Border
  • Border Radius
  • Clear
  • Cursor
  • Direction
  • Float
  • Left/Right
  • Margin
  • Padding
  • Text Alignment & Indent
  1. Front-end development
  2. Changing UI styles: introduction to the pattern library

Read Direction

PreviousCreate a New Component from ScratchNextDesign: overview

Ushahidi's user interface displays LTR (left-to-right) by default, but Ushahidi also supports RTL (right-to-left), so if the user's preferred language is a RTL language, the UI will display accordingly.

When building this feature, it was important to maintain one code base that supported both LTR and RTL read direction. In order to accomplish this we decided to use a library of Sass mixins and functions to automatically flip the CSS styles for RTL (right-to-left) read direction when needed. We decided to go with open-source library, which supports the following properties:

  • background

  • background-position

  • border

  • border-radius

  • clear

  • cursor

  • direction

  • float

  • left/right

  • margin

  • padding

  • text-align

  • text-indent

LTR/RTL body class

ltr-namespace is the default body class, but if a user selects an RTL language when creating a deployment, that body class will change to rtl-namespace and display all UI elements as RTL.

Conflicts

@include span-columns(12);

which compiles to:

float: left;
display: block;
width: 100%;

but in order to correctly display the float in both LTR and RTL, you have to manually override the float: left; like so:

@include span-columns(12);
@include float(left);

which compiles to:

float: left; // would be overridden
display: block;
width: 100%;
float: left; // would be left or right depending on language

Supported Properties

Example

@include border-left(3px solid #000);

would compile to:

border-left: 3px solid #000 // default LTR

border-right: 3px solid #000 // RTL

Background & Background Position

#background-position {
    @include background-position(8px 100px);
}
#background-position-left {
    @include background-position(left 100px);
}
#background-position-right {
    @include background-position(right 100px);
}
#background-position-center {
    @include background-position(center 100px);
}
#background-1 {
    @include background(url(../img/ushahidi-logo-black.svg) no-repeat 20px center);
}
#background-1-left {
    @include background(url(../img/ushahidi-logo-black.svg) no-repeat left center);
}
#background-1-right {
    @include background(url(../img/ushahidi-logo-black.svg) no-repeat right center);
}
#background-1-center {
    @include background(url(../img/ushahidi-logo-black.svg) no-repeat center center);
}
#background-2 {
    @include background(#999 url(../img/ushahidi-logo.svg) no-repeat 8px center);
}
#background-2-left {
    @include background(#999 url(../img/ushahidi-logo.svg) no-repeat left center);
}
#background-2-right {
    @include background(#999 url(../img/ushahidi-logo.svg) no-repeat right center);
}
#background-2-center {
    @include background(#999 url(../img/ushahidi-logo.svg) no-repeat center center);
}

Border

#border-left {
    @include border-left(3px solid #000);
}
#border-right {
    @include border-right(3px solid #000);
}

Border Radius

#border-top-left-radius {
    @include border-top-left-radius(10px);
}
#border-top-right-radius {
    @include border-top-right-radius(10px);
}
#border-bottom-left-radius {
    @include border-bottom-left-radius(10px);
}
#border-bottom-right-radius {
    @include border-bottom-right-radius(10px);
}

Clear

#clear-origin-left {
    @include float(left);
    @include clear(left);
}
#clear-origin-right {
    @include float(right);
    @include clear(right);
}

Cursor

#cursor-e {
    @include cursor(e-resize);
}
#cursor-ne {
    @include cursor(ne-resize);
}
#cursor-se {
    @include cursor(se-resize);
}
#cursor-w {
    @include cursor(w-resize);
}
#cursor-nw {
    @include cursor(nw-resize);
}
#cursor-sw {
    @include cursor(sw-resize);
}

Direction

#direction {
    @include direction;
}

Float

#float-origin-left {
    @include float(left);
}
#float-origin-right {
    @include float(right);
}

Left/Right

#left {
    @include left(20px);
}
#right {
    @include right(20px);
}

Margin

#margin-0-8px-16px-24px {
    @include margin(0 8px 16px 24px);
}
#margin-left {
    @include margin-left(20px);
}
#margin-right {
    @include margin-right(20px);
}

Padding

#padding-0-8px-16px-24px {
    @include lrswap(padding, 0 8px 16px 24px);
}
#padding-left {
    @include padding-left(20px);
}
#padding-right {
    @include padding-right(20px);
}

Text Alignment & Indent

#text-align-left {
    @include text-align(left);
}
#text-align-right {
    @include text-align(right);
}
#text-indent {
    @include text-indent(20px);

    text-align: left;
}

The Ushahidi UI uses the lightweight semantic grid and this Neat span-columns mixin:

RTL-Sass
Bourbon Neat