Files
notifications-admin/app/assets/stylesheets/main.scss

53 lines
2.2 KiB
SCSS
Raw Normal View History

// Dependencies from GOV.UK Frontend Toolkit
2015-11-23 13:50:37 +00:00
// https://github.com/alphagov/govuk_frontend_toolkit/
@import '../govuk_frontend_toolkit/stylesheets/conditionals';
@import '../govuk_frontend_toolkit/stylesheets/shims';
@import '../govuk_frontend_toolkit/stylesheets/measurements';
@import '../govuk_frontend_toolkit/stylesheets/css3';
@import '../govuk_frontend_toolkit/stylesheets/colours';
@import '../govuk_frontend_toolkit/stylesheets/typography';
@import '../govuk_frontend_toolkit/stylesheets/grid_layout';
@import '../govuk_frontend_toolkit/stylesheets/helpers';
@import '../govuk_frontend_toolkit/stylesheets/url-helpers';
@import '../govuk_frontend_toolkit/stylesheets/design-patterns/buttons';
@import '../govuk_frontend_toolkit/stylesheets/design-patterns/alpha-beta';
2015-11-23 13:50:37 +00:00
// Dependencies from GOV.UK Elements
2015-11-23 13:50:37 +00:00
// https://github.com/alphagov/govuk_elements
@import '../govuk_elements/public/sass/elements/helpers';
@import '../govuk_elements/public/sass/elements/reset';
@import '../govuk_elements/public/sass/elements/buttons';
@import '../govuk_elements/public/sass/elements/details';
@import '../govuk_elements/public/sass/elements/elements-typography';
@import '../govuk_elements/public/sass/elements/forms';
@import '../govuk_elements/public/sass/elements/forms/form-validation';
@import '../govuk_elements/public/sass/elements/forms/form-block-labels';
@import '../govuk_elements/public/sass/elements/forms/form-validation';
@import '../govuk_elements/public/sass/elements/icons';
@import '../govuk_elements/public/sass/elements/layout';
@import '../govuk_elements/public/sass/elements/lists';
@import '../govuk_elements/public/sass/elements/panels';
@import '../govuk_elements/public/sass/elements/tables';
// Specific to this application
2015-12-17 10:18:31 +00:00
@import 'grids';
@import 'components/template-picker';
@import 'components/placeholder';
@import 'components/sms-message';
@import 'components/page-footer';
@import 'components/table';
@import 'components/navigation';
@import 'components/big-number';
2015-12-17 14:05:35 +00:00
@import 'components/banner';
Enhance message textbox by styling placeholders Users can add placeholders to their messages, eg > …your vehicle ((registration number)) when the message is sent, this gets replaced with the data the user uploads, eg > …your vehicle LC12 BFL We reckon that it will be useful to see that the placeholder has been recognised, ie that its syntax is correct, before uploading any data. We reckon that the best way to do this is by styling it differently to the rest of the text that the user types. This is not a trivial problem. There are two possible ways to do it: 1 Write a Google Docs-style text rendering engine, which completely replaces the native HTML `<textarea>` with a custom control, and programme what should happen when the user types something that looks like a placeholder, or presses an arrow key, or makes a selection, or… 2 Leave the `<textarea>` in place, unmodified, and duplicate layers in front of/behind it to visually replace a placeholder with the blue lozenge Unsurprisingly, this commit implements 2. There are four layers. Each layer contains live-updated copy of the text in the textbox, and each is styled differently: - one layer behind the textbox to make the blue background - the textbox itself - a layer with the white text, which overlays the black text of the textbox - a layer with an inner shadow to knock back the brackets This is because of some interesting limitations: - The text in the foreground and background must occupy the same physical space, so no deleting characters from the duplicated layers - Words can’t be split up into multiple elements, eg `<span>((</span>regist…`:—this results in slightly different kerning to `((regis…`, which messes up the alignment of the layers - The textbox can’t be completely overlapped with a block of colour, because the cursor disappears behind it. Trying to edit text when you can’t see the cursor is hard. Implementation Technically this makes use of Paul Hayes work on Javascript modules in the GOV.UK frontend toolkit[1]. It also makes use of the `oninput` event to detect changes to the textbox’s contents. This is much more performant than `onkeydown`, `onpaste`, etc. Without it the delay between user input and the layers all updating is too slow and you see misalignment of the layers. 1. https://github.com/alphagov/govuk_frontend_toolkit/pull/227
2015-12-20 00:00:01 +00:00
@import 'components/textbox';
@import 'components/browse-list';
@import 'components/management-navigation';
@import 'components/dropdown';
@import 'components/email-message';
@import 'views/job';
// TODO: break this up
@import 'app';