text:
use Error;
use Unit;
use ffi;
use glib;
use glib::GString;
use glib::translate::*;
use std::ptr;

glib_wrapper! {
    #[derive(Debug, PartialOrd, Ord, Hash)]
    pub struct PaperSize(Boxed<ffi::GtkPaperSize>);

    match fn {
        copy => |ptr| ffi::gtk_paper_size_copy(mut_override(ptr)),
        free => |ptr| ffi::gtk_paper_size_free(ptr),
        get_type => || ffi::gtk_paper_size_get_type(),
    }
}

impl PaperSize {
    pub fn new<'a, P: Into<Option<&'a str>>>(name: P) -> PaperSize {
        assert_initialized_main_thread!();
        let name = name.into();
        unsafe {
            from_glib_full(ffi::gtk_paper_size_new(name.to_glib_none().0))
        }
    }

    pub fn new_custom(name: &str, display_name: &str, width: f64, height: f64, unit: Unit) -> PaperSize {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_full(ffi::gtk_paper_size_new_custom(name.to_glib_none().0, display_name.to_glib_none().0, width, height, unit.to_glib()))
        }
    }

    #[cfg(any(feature = "v3_22", feature = "dox"))]
    pub fn new_from_gvariant(variant: &glib::Variant) -> PaperSize {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_full(ffi::gtk_paper_size_new_from_gvariant(variant.to_glib_none().0))
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn new_from_ipp(ipp_name: &str, width: f64, height: f64) -> PaperSize {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_full(ffi::gtk_paper_size_new_from_ipp(ipp_name.to_glib_none().0, width, height))
        }
    }

    pub fn new_from_key_file<'a, P: Into<Option<&'a str>>>(key_file: &glib::KeyFile, group_name: P) -> Result<PaperSize, Error> {
        assert_initialized_main_thread!();
        let group_name = group_name.into();
        unsafe {
            let mut error = ptr::null_mut();
            let ret = ffi::gtk_paper_size_new_from_key_file(key_file.to_glib_none().0, group_name.to_glib_none().0, &mut error);
            if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
        }
    }

    pub fn new_from_ppd(ppd_name: &str, ppd_display_name: &str, width: f64, height: f64) -> PaperSize {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_full(ffi::gtk_paper_size_new_from_ppd(ppd_name.to_glib_none().0, ppd_display_name.to_glib_none().0, width, height))
        }
    }

    pub fn get_default_bottom_margin(&self, unit: Unit) -> f64 {
        unsafe {
            ffi::gtk_paper_size_get_default_bottom_margin(mut_override(self.to_glib_none().0), unit.to_glib())
        }
    }

    pub fn get_default_left_margin(&self, unit: Unit) -> f64 {
        unsafe {
            ffi::gtk_paper_size_get_default_left_margin(mut_override(self.to_glib_none().0), unit.to_glib())
        }
    }

    pub fn get_default_right_margin(&self, unit: Unit) -> f64 {
        unsafe {
            ffi::gtk_paper_size_get_default_right_margin(mut_override(self.to_glib_none().0), unit.to_glib())
        }
    }

    pub fn get_default_top_margin(&self, unit: Unit) -> f64 {
        unsafe {
            ffi::gtk_paper_size_get_default_top_margin(mut_override(self.to_glib_none().0), unit.to_glib())
        }
    }

    pub fn get_display_name(&self) -> Option<GString> {
        unsafe {
            from_glib_none(ffi::gtk_paper_size_get_display_name(mut_override(self.to_glib_none().0)))
        }
    }

    pub fn get_height(&self, unit: Unit) -> f64 {
        unsafe {
            ffi::gtk_paper_size_get_height(mut_override(self.to_glib_none().0), unit.to_glib())
        }
    }

    pub fn get_name(&self) -> Option<GString> {
        unsafe {
            from_glib_none(ffi::gtk_paper_size_get_name(mut_override(self.to_glib_none().0)))
        }
    }

    pub fn get_ppd_name(&self) -> Option<GString> {
        unsafe {
            from_glib_none(ffi::gtk_paper_size_get_ppd_name(mut_override(self.to_glib_none().0)))
        }
    }

    pub fn get_width(&self, unit: Unit) -> f64 {
        unsafe {
            ffi::gtk_paper_size_get_width(mut_override(self.to_glib_none().0), unit.to_glib())
        }
    }

    pub fn is_custom(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_paper_size_is_custom(mut_override(self.to_glib_none().0)))
        }
    }

    fn is_equal(&self, size2: &PaperSize) -> bool {
        unsafe {
            from_glib(ffi::gtk_paper_size_is_equal(mut_override(self.to_glib_none().0), mut_override(size2.to_glib_none().0)))
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn is_ipp(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_paper_size_is_ipp(mut_override(self.to_glib_none().0)))
        }
    }

    pub fn set_size(&mut self, width: f64, height: f64, unit: Unit) {
        unsafe {
            ffi::gtk_paper_size_set_size(self.to_glib_none_mut().0, width, height, unit.to_glib());
        }
    }

    #[cfg(any(feature = "v3_22", feature = "dox"))]
    pub fn to_gvariant(&mut self) -> Option<glib::Variant> {
        unsafe {
            from_glib_none(ffi::gtk_paper_size_to_gvariant(self.to_glib_none_mut().0))
        }
    }

    pub fn to_key_file(&mut self, key_file: &glib::KeyFile, group_name: &str) {
        unsafe {
            ffi::gtk_paper_size_to_key_file(self.to_glib_none_mut().0, key_file.to_glib_none().0, group_name.to_glib_none().0);
        }
    }

    pub fn get_default() -> Option<GString> {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_none(ffi::gtk_paper_size_get_default())
        }
    }

    pub fn get_paper_sizes(include_custom: bool) -> Vec<PaperSize> {
        assert_initialized_main_thread!();
        unsafe {
            FromGlibPtrContainer::from_glib_full(ffi::gtk_paper_size_get_paper_sizes(include_custom.to_glib()))
        }
    }
}

impl PartialEq for PaperSize {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.is_equal(other)
    }
}

impl Eq for PaperSize {}


text:
using ApacheOrcDotNet.Statistics;
using ProtoBuf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ApacheOrcDotNet.Protocol
{
	[ProtoContract]
    public class RowIndexEntry
    {
		[ProtoMember(1, IsPacked = true)]
		public List<ulong> Positions { get; } = new List<ulong>();
		[ProtoMember(2)]
		public ColumnStatistics Statistics { get; } = new ColumnStatistics();
    }
}

redpajama_set_name: RedPajamaGithub


text:
let path = require('path');
module.exports = {
    entry: './src/collectNavigation.js',
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'bundle.js'
    }
};


text:
 - A running kubernetes cluster setup with [Persistent Volumes][storage]. We advise running 1 Cassandra pod per k8 node, and hence please plan your environment accordingly.
  > Note: See [AKS](./providers/aks.md) notes to properly define parameters for clusters running on AKS.

  > Note: See [GKE PV](./providers/gke.md) for notes to setup the persistent volumes properly on GKE.

  > Note: See [Local setup](./providers/local.md) for notes on setting up a local kubernetes cluster

### Deploy the Operator

 1) Deploy the [CRDs][crds] used by the operator to manage Cassandra clusters:

    ```
    kubectl apply -f deploy/crds.yaml
    ```

 1) Deploy the operator:

    ```
    kubectl apply -f deploy/bundle.yaml
    ```

 1) Verify the operator is running:

    ```
    kubectl get pods | grep cassandra-operator
    ```

    ```
    cassandra-operator-5755f6855f-t9hvm   1/1     Running   0          65s
    ```
### Custom Cassandra configurations

It is possible to configure Cassandra by providing custom configuration. Refer to [Custom configurations](custom-configuration.md) for options to configure your cluster.

## Deploy a Cassandra cluster

> NOTE: To deploy the Cassandra cluster, one can use an example yaml provided in the `examples` directory. There are 2 examples included in the repo:
>  - example-datacenter.yaml -> a full example will all the fields showing usage. Use it as a template for your usecase.
>  - example-datacenter-minimal.yaml -> the minimal example of the yaml. To use this example, you must also create a configMap called "cassandra-operator-default-config" that will have default values used by operator set:
>     ```yaml
>     apiVersion: v1
>     kind: ConfigMap
>     metadata:
>       name: cassandra-operator-default-config
>     data:
>       nodes: "3"
>       cassandraImage: gcr.io/cassandra-operator/cassandra:3.11.4
>       sidecarImage: gcr.io/cassandra-operator/cassandra-sidecar:latest
>       memory: 1Gi
>       disk: 1Gi
>    ```
> This configMap is already loaded into your k8 environment if you've used `deploy/bundle.yaml` to load operator's configuration.

 1) Make sure to set all apropriate values and fields in the yaml `examples/example-datacenter.yaml`
 1) Deploy the cluster
     ```bash
     # kubectl apply -f examples/example-datacenter.yaml
     ```
 1) Wait for the pods to become ready:
    >NOTE: It could take a few minutes for the pods to converge while persistent volumes are being
    automatically provisioned and attached to the cluster nodes.

    ```
    kubectl get pods | grep cassandra-test
    ```

    ```
    NAME                                          READY   STATUS             RESTARTS   AGE
    cassandra-test-dc-cassandra-west1-a-0   2/2     Running            2          84m
    cassandra-test-dc-cassandra-west1-b-0   2/2     Running            0          83m
    cassandra-test-dc-cassandra-wesr1-c-0   2/2     Running            0          81m
    ```
 1) Verify the Cassandra cluster is healthy:

    ```
    kubectl exec cassandra-test-dc-cassandra-west1-a-0 -c cassandra -- nodetool status
    ```

    ```
    Datacenter: test-dc-cassandra
    ==========================
    Status=Up/Down
    |/ State=Normal/Leaving/Joining/Moving
    --  Address      Load       Tokens       Owns (effective)  Host ID                               Rack
    UN  10.244.1.14  87.41 KiB  256          62.9%             dcf940c2-18d2-4a3a-8abf-833acadeca7e  west1-a
    UN  10.244.2.9   87.38 KiB  256          69.6%             fd59fa32-aab0-485e-b04b-7ad4b75e54dd  west1-b
    UN  10.244.0.10  69.91 KiB  256          67.5%             9e4883a1-e822-472f-920f-f2fc36c340c8  west1-c
    ```

 1) Issue a sample query to the cluster:

    ```
    kubectl exec cassandra-test-dc-cassandra-west1-a-0 -c cassandra -- cqlsh -e "SELECT now() FROM system.local;" cassandra-test-dc-cassandra-nodes
    ```

    ```
     system.now()
    --------------------------------------
     243e2fd0-d64a-11e9-b8a4-2dd801fa1b1c

    (1 rows)
    ```
### Resize a Cassandra cluster

 1) Create a Cassandra cluster, if you haven't already:

    ```bash
    $ kubectl apply -f example/example-datacenter.yaml
    ```

 1) In `example/example-datacenter.yaml` the initial cluster size is 3. Modify the file and change `replicas` from 3 to 5.

    ```yaml
    spec:
      replicas: 5
      image: "gcr.io/cassandra-operator/cassandra:latest"
    ```

 1) Apply the size change to the cluster CR:
    ```bash
    $ kubectl apply -f example/example-datacenter.yaml
    ```
    The Cassandra cluster will scale to 5 members (5 pods):
    ```bash
    $ kubectl get pods
    NAME                                    READY     STATUS    RESTARTS   AGE
    cassandra-test-dc-cassandra-west1-a-0   2/2       Running   1          10m12s
    cassandra-test-dc-cassandra-west1-a-1   2/2       Running   2          3m2s
    cassandra-test-dc-cassandra-west1-b-0   2/2       Running   1          8m38s
    cassandra-test-dc-cassandra-west1-b-1   2/2       Running   1          1m4s
    cassandra-test-dc-cassandra-west1-c-0   2/2       Running   0          5m22s
    ```

 1) Similarly we can decrease the size of cluster from 5 back to 3 by changing the size field again and reapplying the change.

    ```yaml
    spec:
      replicas: 3
      image: "gcr.io/cassandra-operator/cassandra:latest"
    ```
    Then apply the changes
    ```bash
    $ kubectl apply -f example/example-datacenter.yaml
    ```

    > **Note: scaling up/down is a long operation that performs actions in the background that are not visible to kubernetes tools. It might take long time until some "activity" is seen (like nodes in `LEAVING` state or pods terminating). Please do not rerun this command many times, but just follow the sidecar log (via `kubectl logs <pod name> --container sidecar` and cassandra status via `kubectl exec <pod name> -c cassandra -- bash "nodetool status"`)**

## Cleanup

>**WARNING! The following will delete the Cassandra cluster deployed in the previous steps as well
>as all of its data.**

### Delete the Cassandra Cluster

 1) Delete the Cassandra cluster:

    ```
    kubectl delete -f examples/example-datacenter.yaml
    ```

 1) Delete the PVCs created automatically for the pods:

    ```
    kubectl delete pvc data-volume-cassandra-cassandra-test-{rack name}-{num}
    ```

### Delete the Operator

 1) Delete the operator:

    ```
    kubectl delete -f deploy
    ```

 1) Delete the RBAC and PSP resources:

    ```
    kubectl delete -f deploy/cassandra
    ```

 1) Delete the CRDs:

    ```
    kubectl delete -f deploy/crds.yaml
    ```

[aks]: https://azure.microsoft.com/en-in/services/kubernetes-service/
[gke]: https://console.cloud.google.com/kubernetes
[crds]: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/#customresourcedefinitions
[psps]: https://kubernetes.io/docs/concepts/policy/pod-security-policy/
[rbac]: https://kubernetes.io/docs/reference/access-authn-authz/rbac/
[storage]: https://kubernetes.io/docs/concepts/storage/persistent-volumes/


text:
.. _idle:

IDLE
====

.. moduleauthor:: Guido van Rossum <guido@Python.org>

.. index::
   single: IDLE
   single: Python Editor
   single: Integrated Development Environment

IDLE is the Python IDE built with the :mod:`tkinter` GUI toolkit.

IDLE has the following features:

* coded in 100% pure Python, using the :mod:`tkinter` GUI toolkit

* cross-platform: works on Windows and Unix

* multi-window text editor with multiple undo, Python colorizing and many other
  features, e.g. smart indent and call tips

* Python shell window (a.k.a. interactive interpreter)

* debugger (not complete, but you can set breakpoints, view  and step)

Menus
-----

File menu
^^^^^^^^^

New window
   create a new editing window

Open...
   open an existing file

Open module...
   open an existing module (searches sys.path)

Class browser
   show classes and methods in current file

Path browser
   show sys.path directories, modules, classes and methods

.. index::
   single: Class browser
   single: Path browser

Save
   save current window to the associated file (unsaved windows have a \* before and
   after the window title)

Save As...
   save current window to new file, which becomes the associated file

Save Copy As...
   save current window to different file without changing the associated file

Close
   close current window (asks to save if unsaved)

Exit
   close all windows and quit IDLE (asks to save if unsaved)

Edit menu
^^^^^^^^^

Undo
   Undo last change to current window (max 1000 changes)

Redo
   Redo last undone change to current window

Cut
   Copy selection into system-wide clipboard; then delete selection

Copy
   Copy selection into system-wide clipboard

Paste
   Insert system-wide clipboard into window

Select All
   Select the entire contents of the edit buffer

Find...
   Open a search dialog box with many options

Find again
   Repeat last search

Find selection
   Search for the string in the selection

Find in Files...
   Open a search dialog box for searching files

Replace...
   Open a search-and-replace dialog box

Go to line
   Ask for a line number and show that line

Indent region
   Shift selected lines right 4 spaces

Dedent region
   Shift selected lines left 4 spaces

Comment out region
   Insert ## in front of selected lines

Uncomment region
   Remove leading # or ## from selected lines

Tabify region
   Turns *leading* stretches of spaces into tabs

Untabify region
   Turn *all* tabs into the right number of spaces

Expand word
   Expand the word you have typed to match another word in the same buffer; repeat
   to get a different expansion

Format Paragraph
   Reformat the current blank-line-separated paragraph

Import module
   Import or reload the current module

Run script
   Execute the current file in the __main__ namespace

.. index::
   single: Import module
   single: Run script

Windows menu
^^^^^^^^^^^^

Zoom Height
   toggles the window between normal size (24x80) and maximum height.

The rest of this menu lists the names of all open windows; select one to bring
it to the foreground (deiconifying it if necessary).

Debug menu (in the Python Shell window only)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Go to file/line
   look around the insert point for a filename and linenumber, open the file, and
   show the line.

Open stack viewer
   show the stack traceback of the last exception

Debugger toggle
   Run commands in the shell under the debugger

JIT Stack viewer toggle
   Open stack viewer on traceback

.. index::
   single: stack viewer
   single: debugger

Basic editing and navigation
----------------------------

* :kbd:`Backspace` deletes to the left; :kbd:`Del` deletes to the right

* Arrow keys and :kbd:`Page Up`/:kbd:`Page Down` to move around

* :kbd:`Home`/:kbd:`End` go to begin/end of line

* :kbd:`C-Home`/:kbd:`C-End` go to begin/end of file

* Some :program:`Emacs` bindings may also work, including :kbd:`C-B`,
  :kbd:`C-P`, :kbd:`C-A`, :kbd:`C-E`, :kbd:`C-D`, :kbd:`C-L`

Automatic indentation
^^^^^^^^^^^^^^^^^^^^^

After a block-opening statement, the next line is indented by 4 spaces (in the
Python Shell window by one tab).  After certain keywords (break, return etc.)
the next line is dedented.  In leading indentation, :kbd:`Backspace` deletes up
to 4 spaces if they are there. :kbd:`Tab` inserts 1-4 spaces (in the Python
Shell window one tab). See also the indent/dedent region commands in the edit
menu.

Python Shell window
^^^^^^^^^^^^^^^^^^^

* :kbd:`C-C` interrupts executing command

* :kbd:`C-D` sends end-of-file; closes window if typed at a ``>>>`` prompt

* :kbd:`Alt-p` retrieves previous command matching what you have typed

* :kbd:`Alt-n` retrieves next

* :kbd:`Return` while on any previous command retrieves that command

* :kbd:`Alt-/` (Expand word) is also useful here

.. index:: single: indentation

Syntax colors
-------------

The coloring is applied in a background "thread," so you may occasionally see
uncolorized text.  To change the color scheme, edit the ``[Colors]`` section in
:file:`config.txt`.

Python syntax colors:
   Keywords
      orange

   Strings
      green

   Comments
      red

   Definitions
      blue

Shell colors:
   Console output
      brown

   stdout
      blue

   stderr
      dark green

   stdin
      black

Startup
-------

Upon startup with the ``-s`` option, IDLE will execute the file referenced by
the environment variables :envvar:`IDLESTARTUP` or :envvar:`PYTHONSTARTUP`.
Idle first checks for ``IDLESTARTUP``; if ``IDLESTARTUP`` is present the file
referenced is run.  If ``IDLESTARTUP`` is not present, Idle checks for
``PYTHONSTARTUP``.  Files referenced by these environment variables are
convenient places to store functions that are used frequently from the Idle
shell, or for executing import statements to import common modules.

In addition, ``Tk`` also loads a startup file if it is present.  Note that the
Tk file is loaded unconditionally.  This additional file is ``.Idle.py`` and is
looked for in the user's home directory.  Statements in this file will be
executed in the Tk namespace, so this file is not useful for importing functions
to be used from Idle's Python shell.

Command line usage
^^^^^^^^^^^^^^^^^^

::

   idle.py [-c command] [-d] [-e] [-s] [-t title] [arg] ...

   -c command  run this command
   -d          enable debugger
   -e          edit mode; arguments are files to be edited
   -s          run $IDLESTARTUP or $PYTHONSTARTUP first
   -t title    set title of shell window

If there are arguments:

#. If ``-e`` is used, arguments are files opened for editing and
   ``sys.argv`` reflects the arguments passed to IDLE itself.

#. Otherwise, if ``-c`` is used, all arguments are placed in
   ``sys.argv[1:...]``, with ``sys.argv[0]`` set to ``'-c'``.

#. Otherwise, if neither ``-e`` nor ``-c`` is used, the first
   argument is a script which is executed with the remaining arguments in
   ``sys.argv[1:...]``  and ``sys.argv[0]`` set to the script name.  If the script
   name is '-', no script is executed but an interactive Python session is started;
   the arguments are still available in ``sys.argv``.


text:
/*
  Application middleware index file
 */

// module dependencies
var system = require('./system_components');
var error = require('./error_handling');

function installMiddleware(app, middleware) {
  for (var component of middleware) {
    if (Array.isArray(component))
      app.use(component[0], component[1]);
    else if (component)
      app.use(component);
  }
}

module.exports = {
  // install before routing middleware on app
  // @param {express} app app to install middleware
  installRequestMiddleware: (app) => {
    // install system required middleware
    installMiddleware(app, system);
  },

  // install after routing (error handling) middleware on app
  // @param {express} app app to install middleware
  installErrorHandling: (app) => {
    // Setup middleware for error handling
    installMiddleware(app, error(app));
  },
}


text:
package org.springframework.boot.configurationsample;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Alternative to Spring Boot's {@code @ConstructorBinding} for testing (removes the need
 * for a dependency on the real annotation).
 *
 * @author Stephane Nicoll
 */
@Target(ElementType.CONSTRUCTOR)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface ConstructorBinding {

}


text:
<?xml version="1.0" encoding="UTF-8"?>

<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">

	<properties>
		<title>tidesdk-maven-plugin - Tasks</title>
		<author>simon Sparks</author>
	</properties>

None as yet

Contact the mailing lists for more details or to help.

</document>


text:
<?php

namespace Trsteel\CkeditorBundle\Tests\Form;

use Symfony\Component\Form\Tests\Extension\Core\Type\TypeTestCase;
use Trsteel\CkeditorBundle\Form\CkeditorType;
use Trsteel\CkeditorBundle\Transformer\StripJS;
use Trsteel\CkeditorBundle\Transformer\StripCSS;
use Trsteel\CkeditorBundle\Transformer\StripComments;

class CkeditorTypeTest extends TypeTestCase
{
    protected static $kernel;
    protected static $container;

    public static function setUpBeforeClass()
    {
        self::$kernel = new \AppKernel('dev', true);
        self::$kernel->boot();

        self::$container = self::$kernel->getContainer();
    }

    public function get($serviceId)
    {
        return self::$kernel->getContainer()->get($serviceId);
    }

    public function setUp()
    {
        parent::setUp();

        $CkeditorType = new CkeditorType($this->get('service_container'));

        $CkeditorType->addTransformer(new StripJS(), 'strip_js');
        $CkeditorType->addTransformer(new StripCSS(), 'strip_css');
        $CkeditorType->addTransformer(new StripComments(), 'strip_comments');

        $this->factory->addType($CkeditorType);
    }

    /**
     * Check the default required property
     */
    public function testDefaultRequired()
    {
        $form = $this->factory->create('ckeditor');
        $view = $form->createView();
        $required = $view->get('required');

        $this->assertFalse($required);
    }

    /**
     * Check the required property
     */
    public function testRequired()
    {
        $this->setExpectedException('Symfony\Component\Form\Exception\InvalidOptionException');

        $form = $this->factory->create('ckeditor', null, array(
            'required' => true
        ));
    }

    /**
     * Check the default toolbar property
     */
    public function testDefaultToolbar()
    {
        $form = $this->factory->create('ckeditor');
        $view = $form->createView();
        $toolbar = $view->get('toolbar');

        $this->assertEquals($toolbar, array(
            array(
                'name' => 'document',
                'items' => array(
                    'Source',
                    '-',
                    'Save',
                    '-',
                    'Templates',
                )
            ),
            array(
                'name' => 'clipboard',
                'items' => array(
                    'Cut',
                    'Copy',
                    'Paste',
                    'PasteText',
                    'PasteFromWord',
                    '-',
                    'Undo',
                    'Redo',
                )
            ),
            array(
                'name' => 'editing',
                'items' => array(
                    'Find',
                    'Replace',
                    '-',
                    'SelectAll',
                )
            ),
            '/',
            array(
                'name' => 'basicstyles',
                'items' => array(
                    'Bold',
                    'Italic',
                    'Underline',
                    'Strike',
                    'Subscript',
                    'Superscript',
                    '-',
                    'RemoveFormat',
                )
            ),
            array(
                'name' => 'paragraph',
                'items' => array(
                    'NumberedList',
                    'BulletedList',
                    '-',
                    'Outdent',
                    'Indent',
                    '-',
                    'JustifyLeft',
                    'JustifyCenter',
                    'JustifyRight',
                    'JustifyBlock',
                )
            ),
            array(
                'name' => 'links',
                'items' => array(
                    'Link',
                    'Unlink',
                    'Anchor',
                )
            ),
            '/',
            array(
                'name' => 'insert',
                'items' => array(
                    'Image',
                    'Flash',
                    'Table',
                    'HorizontalRule',
                )
            ),
            array(
                'name' => 'styles',
                'items' => array(
                    'Styles',
                    'Format',
                )
            ),
            array(
                'name' => 'tools',
                'items' => array(
                    'Maximize',
                    'ShowBlocks',
                )
            )
        ));
    }

    /**
     * Check the toolbar property
     */
    public function testToolbar()
    {
        $form = $this->factory->create('ckeditor', null, array(
            'toolbar' => array(
                'document',
            ),
            'toolbar_groups' => array(
                'document' => array(
                    'Source'
                )
            )
        ));
        $view = $form->createView();
        $toolbar = $view->get('toolbar');

        $this->assertEquals($toolbar, array(
            array(
                'name'  => 'document',
                'items' => array(
                    'Source'
                )
            )
        ));
    }

    /**
     * Check default startup_outline_blocks property
     */
    public function testDefaultstartupOutlineBlocks()
    {
        $form = $this->factory->create('ckeditor');
        $view = $form->createView();
        $startup_outline_blocks = $view->get('startup_outline_blocks');

        $this->assertTrue($startup_outline_blocks);
    }

    /**
     * Checks startup_outline_blocks property
     */
    public function teststartupOutlineBlocks()
    {
        $form = $this->factory->create('ckeditor', null, array(
            'startup_outline_blocks' => false
        ));

        $view = $form->createView();
        $startup_outline_blocks = $view->get('startup_outline_blocks');

        $this->assertFalse($startup_outline_blocks);
    }

    /**
     * Check default ui_color property
     */
    public function testDefaultUiColor()
    {
        $form = $this->factory->create('ckeditor');
        $view = $form->createView();
        $ui_color = $view->get('ui_color');

        $this->assertNull($ui_color);
    }

    /**
     * Checks ui_color property
     */
    public function testUiColor()
    {
        $form = $this->factory->create('ckeditor', null, array(
            'ui_color' => '#333333'
        ));

        $view = $form->createView();
        $ui_color = $view->get('ui_color');

        $this->assertEquals($ui_color, '#333333');
    }

    /**
     * Check default width property
     */
    public function testDefaultWidth()
    {
        $form = $this->factory->create('ckeditor');
        $view = $form->createView();
        $width = $view->get('width');

        $this->assertNull($width);
    }

    /**
     * Checks width property
     */
    public function testWidth()
    {
        $form = $this->factory->create('ckeditor', null, array(
            'width' => '100%'
        ));

        $view = $form->createView();
        $width = $view->get('width');

        $this->assertEquals($width, '100%');
    }

    /**
     * Check default height property
     */
    public function testDefaultHeight()
    {
        $form = $this->factory->create('ckeditor');
        $view = $form->createView();
        $height = $view->get('height');

        $this->assertNull($height);
    }

    /**
     * Checks height property
     */
    public function testHeight()
    {
        $form = $this->factory->create('ckeditor', null, array(
            'height' => '350px'
        ));

        $view = $form->createView();
        $height = $view->get('height');

        $this->assertEquals($height, '350px');
    }

    /**
     * Check default language property
     */
    public function testDefaultLanguage()
    {
        $form = $this->factory->create('ckeditor');
        $view = $form->createView();
        $language = $view->get('language');

        $this->assertNull($language);
    }

    /**
     * Checks language property
     */
    public function testLanguage()
    {
        $form = $this->factory->create('ckeditor', null, array(
            'language' => 'en-au'
        ));

        $view = $form->createView();
        $language = $view->get('language');

        $this->assertEquals($language, 'en-au');
    }

    /**
     * Checks filebrowserBrowseUrl property
     */
    public function testFilebrowserBrowseUrl()
    {
        $form = $this->factory->create('ckeditor', null, array(
            'filebrowser_browse_url' => '/myfilebrowser/browser.html'
        ));

        $view = $form->createView();
        $filebrowserBrowseUrl = $view->get('filebrowser_browse_url');

        $this->assertEquals($filebrowserBrowseUrl, '/myfilebrowser/browser.html');
    }

    /**
     * Checks filebrowserUploadUrl property
     */
    public function testFilebrowserUploadUrl()
    {
        $form = $this->factory->create('ckeditor', null, array(
            'filebrowser_upload_url' => '/myfilebrowser/uploads'
        ));

        $view = $form->createView();
        $filebrowserUploadUrl = $view->get('filebrowser_upload_url');

        $this->assertEquals($filebrowserUploadUrl, '/myfilebrowser/uploads');
    }

    /**
     * Checks filebrowserImageBrowseUrl property
     */
    public function testFilebrowserImageBrowseUrl()
    {
        $form = $this->factory->create('ckeditor', null, array(
            'filebrowser_image_browse_url' => '/myfilebrowser/browser.html'
        ));

        $view = $form->createView();
        $filebrowserImageBrowseUrl = $view->get('filebrowser_image_browse_url');

        $this->assertEquals($filebrowserImageBrowseUrl, '/myfilebrowser/browser.html');
    }

    /**
     * Checks filebrowserImageUploadUrl property
     */
    public function testFilebrowserImageUploadUrl()
    {
        $form = $this->factory->create('ckeditor', null, array(
            'filebrowser_image_upload_url' => '/myfilebrowser/uploads'
        ));

        $view = $form->createView();
        $filebrowserImageUploadUrl = $view->get('filebrowser_image_upload_url');

        $this->assertEquals($filebrowserImageUploadUrl, '/myfilebrowser/uploads');
    }

    /**
     * Checks filebrowserFlashBrowseUrl property
     */
    public function testFilebrowserFlashBrowseUrl()
    {
        $form = $this->factory->create('ckeditor', null, array(
            'filebrowser_flash_browse_url' => '/myfilebrowser/browser.html'
        ));

        $view = $form->createView();
        $filebrowserFlashBrowseUrl = $view->get('filebrowser_flash_browse_url');

        $this->assertEquals($filebrowserFlashBrowseUrl, '/myfilebrowser/browser.html');
    }

    /**
     * Checks filebrowserFlashUploadUrl property
     */
    public function testFilebrowserFlashUploadUrl()
    {
        $form = $this->factory->create('ckeditor', null, array(
            'filebrowser_flash_upload_url' => '/myfilebrowser/uploads',
        ));

        $view = $form->createView();
        $filebrowserFlashUploadUrl = $view->get('filebrowser_flash_upload_url');

        $this->assertEquals($filebrowserFlashUploadUrl, '/myfilebrowser/uploads');
    }
}


text:
<!DOCTYPE html>

                <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title>What Is Snapchat? A Beginners Guide To Snapchat</title>
        <meta name="description" content="Snapchat is a messaging service that lets users send pictures & videos to one another, in the knowledge that such content will disappear after a set time." />
        <meta name="viewport" content="width=device-width, maximum-scale=1.0">

                <link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,400italic,600italic" rel="stylesheet" type="text/css">

                <link rel="stylesheet" href="//cdn3.recombu.com/assets/recombu-frontend/2.194.1/css/global.min.css" type="text/css" media="screen" />

        <link rel="shortcut icon" href="//cdn2.recombu.com/assets/recombu-frontend/2.194.1/bundles/cars/images/favicon.ico" type="image/x-icon" />
            <link rel="canonical" href="https://recombu.com/mobile/article/what-is-snapchat" />

                <link rel="alternate" type="application/rss+xml" title="Recombu Mobile" href="https://recombu.com/mobile/rss.xml" />

                    <link rel="stylesheet" href="//cdn2.recombu.com/assets/recombu-frontend/2.194.1/css/mobile.min.css" type="text/css" media="screen" />

        <meta name="news_keywords" content="Snapchat, explained, explainer, what, what is, ?, social media, snaps" />

<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@recombu" />
<meta name="twitter:title" content="What is Snapchat? A beginner’s guide to ephemeral social media" />
<meta name="twitter:description" content="You may have heard of or seen people using something called Snapchat, but if you’re unsure what it is or what it’s for, read on for enlightenment." />
<meta name="twitter:image:src" content="https://cdn2.recombu.com/media/mobile/Features/WhatIsSnapchat/SnapchatGhostfaceChillah.jpg" />

<meta property="og:type" content="article" />
<meta property="og:title" content="What is Snapchat? A beginner’s guide to ephemeral social media" />
<meta property="og:description" content="You may have heard of or seen people using something called Snapchat, but if you’re unsure what it is or what it’s for, read on for enlightenment." />
<meta property="fb:app_id" content="175335442476977" />
<meta property="og:image" content="https://cdn2.recombu.com/media/mobile/Features/WhatIsSnapchat/SnapchatGhostfaceChillah.jpg" />
<meta property="og:site_name" content="Recombu" />
<meta property="og:url" content="https://recombu.com/mobile/article/what-is-snapchat" />

    <link rel="amphtml" href="https://recombu.com/mobile/article/what-is-snapchat/amp" />

Jump to main content

Jump to navigation

    Recombu

Front Page

Mobile Phones

Phones

Browse All Phones

Android Phones

iPhone

Windows Phone

BlackBerry

Best selling phones

Apple iPhone 7

                    View deals

                                    Read
                        review

Apple iPhone 7 Plus

                    View deals

Samsung Galaxy S8

                    View deals

Samsung Galaxy S8 Plus

                    View deals

News

All news

Features

Apps

Latest News

LG V30 vs LG V20 Rumours: What's the difference?

Huawei P10 Lite EMUI 5.1 tips, tricks and hidden features

How to add extra storage to the OnePlus 5

Reviews

All reviews

Latest Reviews

Vodafone Smart V8 Review: In Depth

Honor 9 Review: Watch out, OnePlus

Microsoft Surface Pro (2017) Review: In Depth

Videos

Compare

Pay monthly

Pay as you go

SIM only

SIM free

Best selling phones

Apple iPhone 7

                    View deals

                                    Read
                        review

Apple iPhone 7 Plus

                    View deals

Samsung Galaxy S8

                    View deals

Samsung Galaxy S8 Plus

                    View deals

Broadband & TV

Cars

                    <form method="GET" action="/mobile/search" enctype="application/x-www-form-urlencoded" id="search">
    <input type="text" class="terms" placeholder="Search..." name="q" /><input type="submit" title="Search" class="search" value=""/>
</form>

    Channel:

Mobile Phones

Front Page

Broadband & TV

Cars

        Show/hide navigation

            Home / Mobile / Features / Article

Samsung Galaxy S8 and S8 Plus

Android O

OnePlus 5

WWDC 2017

You might also like...

    ×

Snapchat Discover launches, brings current affairs to your phone

Snapchat Spectacles finally coming to Europe, June 2nd: How to find them/where to buy

Snapchat's new creative tools: All you need to know

        OR

Never miss an article again

Enter your email below to keep up to date with the latest news, reviews and exclusive deals on Recombu.

        <form action="/digital/ajax/newsletter-signup" id="newsletter-signup" method="post" novalidate="novalidate">

                <input type="text" name="Email" placeholder="Enter email address...">
                <input type="submit" value="Subscribe" class="btn">

        </form>

What is Snapchat? A beginner's guide to ephemeral social media

By
                            Alex Todd

 <meta itemprop="datePublished" content="2016-11-09T15:13:56+00:00"/><time date-time="2016-11-09T15:13:56+00:00">9th Nov 2016</time>

Features

Tweet

You may have heard of or seen people using something called Snapchat, but if you're unsure what it is or what it's for, read on for enlightenment.

What is Snapchat?

Snapchat is a fun mobile messaging application that lets you share photos, videos, text and drawings that expire and automatically delete themselves after a set time, ranging from a few seconds up to 24 hours. It's free to download and send messages using the service and it's also become insanely popular with adults and teenagers alike. In truth, these are its core features, but over time it's actually evolved to do a number of  other things too (which we'll cover in a bit).

It's available on devices running Google's mobile operating system, Android or Apple's mobile operating system, iOS – that translates to devices like Samsung's Galaxy phones, Sony's Xperia phones and iPhones to name but a few.

Read next: What is Android? and What is iOS?

What is ephemeral social media?

When proto-Snapchat app, Picaboo launched back in 2011, it offered a pretty radical proposition by comparison to established services like Facebook, Twitter and Instagram, all of which centred around storing and preserving their users' digital content.

Snapchat CEO, Evan Spiegel originally pushed the concept as a class project during his time at Stanford University, but it took the help of fellow students Bobby Murphy and Reggie Brown to turn it into a functioning reality.

Snapchat's biggest hook has always been its ephemerality, arriving just as the likes of Meerkat and Periscope were pushing live streaming, with the same focus on timely content that expires once it's no longer relevant. Facebook has since pushed into live video and other apps like Beme have also appeared with a similar approach to Snapchat.

How does Snapchat work?

Photos and videos captured or viewed within Snapchat are known as 'snaps'. You can send snaps to individuals (other Snapchat users you've either added from your device's contact list or by manually inputting their Snapchat username) or to public channels called 'stories'.

If you're sending a still image to another user, you can specify how long it can be viewed for (up to ten seconds), after which the recipient can choose to 'replay' it. However, users can only rewatch snaps once before they completely expire. Similarly, Snapchat lets you record up to ten seconds of video (with or without sound) that you can share – these are then accessible to the recipient in the same fashion as photos.

Whilst snaps are ephemeral, you can actually download your own snaps to your device as you create them and other users can take screenshots on their devices to capture stills of your snaps, but doing so pushes a notification to your phone, so you know they've made a copy of your snap.

Text, filters, drawing and stickers on Snapchat

You don't have to post raw photos or videos with Snapchat, you can also jazz them up with text, filters, doodles and what Snapchat calls 'stickers'. Tapping the 'T' icon at the top of the screen once you've captured a snap brings up a white on black text box that allows for up to two lines of centre-justified text, tapping it again turns it into larger, bold, left-justified text that you can scale, orient, reformat and even change colour. Tapping the text icon a third time changes that text from left to centre justified.

Not unlike Instagram, you can also dress your snaps with different filters. You can add different colour overlays to photos, including a black and white filter, whilst video snaps can be dressed with motion filters; letting you slow down or speed up footage.

There is a third type of filter known as a geofilter, which only becomes available when your snap is taken at a specific location. As Recombu is based in London there are a number of geofilters with elements of the city woven into them, but geofilters can be found all over the place, even for specific events. Geofilters automatically appear alongside the conventional filters that you swipe through after you've captured your snap.

Sometimes you may want to highlight an element in your snap, write in a particular fashion or just add a doodle for fun - that's where the pen tool comes in. Similarly to editing text, you can pick a colour and then draw over your snap (pro tip: Follow Snapchat user Miologie to see Snapchat doodles at their finest).

You can also add stickers to your snaps, which are essentially emoji symbols that you can scale, rotate and position anywhere within your snaps. You can even track stickers to points in your videos so that they move in sync with your snaps (see above).

Lenses on Snapchat

Another way to have a bit of fun with your snaps is by using lenses. If you press and hold on the viewfinder when a person's face is clearly in-frame and facing the camera, you'll see a wireframe mesh briefly appear before bringing up a host of different options near the shutter button.

Lenses can be flat or 3D overlays, designed to sit on or around your face. Some distort your face's shape, some add virtual props like sunglasses and moustaches and some add special effects like fire or bubbles. When swiping between lenses, in some cases you'll also be prompted to open your mouth or raise your eyebrows to activate an animation.

Over time, the way in which Snapchat has implemented lenses has changed, but at the time of writing, all lenses are free and only occasionally change. Like geofilters, some lenses are location specific and only become available under certain circumstances.

In November 2016, Snapchat added World Lenses, which don't require a face to be in-frame to work. By tapping on the screen whilst looking at the viewfinder you can add overlays that affect your environment, such as falling snowflakes or clouds that spew rainbows.

Once you've applied a lens, you can then capture a still or video snap and share it as you would any other.

How do I use Snapchat?

Adding contacts

If you like what you see so far and decided to take the plunge and download Snapchat onto your smartphone a good place to start would be by adding your friends.

After creating an account and signing in, the app will open up on the main viewfinder, swipe downwards to view your profile page, here you can see other users who've added you, add users yourself and view your Snapchat friends (users you've already added).

To add a user, tap 'Add Friends' and you'll be presented with a number of options. If you know a friend's username choose 'Add by username' after which you can type in your friend's username to add them. 'Add from Address Book' lets Snapchat scan your phone's contact list to see whether anyone in your address book is already a Snapchat user. If it finds users within your contact list you'll be presented with a rundown of applicable friends that you can simply tap on to add.

'Add by Snapcode' lets you add a user by scanning a picture of their Snapcode from your phone's photo gallery. Your profile picture is in fact, your Snapcode and it's unique to you (you can also scan Snapcodes from the viewfinder by pressing and holding on the screen). The last option 'Add nearby' scans within your present location for other users also on the 'Add nearby' screen from within their Snapchat app.

Taking and sending snaps

Once you've added friends to share your snaps with, it's time to actually take some. Capturing a snap is simple, open the app and by default, you'll find yourself in the viewfinder. Tapping the big circular shutter key at the bottom of the screen (assuming you're holding your phone in portrait - the preferred orientation for Snapchat) will capture a still image whilst holding it down will start recording video, indicated by a red bar that fills around the shutter button up to a total of ten seconds.

Once you release the shutter key, you'll then have the chance to review whatever it is that you just captured. Videos loop during this review period and sound is played by default, but you can mute them by tapping the speaker icon in the bottom left of the screen (muted video snaps remain muted when shared too).

The review stage is also the point at which you might want to add filters, text or draw on your snap, which you can do using the tools we mentioned earlier. Once you're happy with your Snapsterpiece (Snapchat's word, not ours) your can share it by pressing the circular post button in the bottom right of the screen. You'll then see any available public stories as well as your friends list and you can share to multiple people at once.

What are Snapchat Stories?

Earlier we mentioned stories, which let users review public snaps for up to 24 hours. When capturing a snap, instead of/as well as sending them to specific users privately, you can submit them to the 'My Story' feed. Here, your Snapchat friends can view all of the snaps you've submitted to your story in a continuous stream. There's no limit on how many times users can rewatch your story either (until they expire that is).

As well as stories for individual users, there are also collaborative stories called Live Stories. Similarly to geofilters, users can only submit snaps to these stories when they're in the right location at the right time. As an example, London has a story that any Snapchat users in the area can post to (although there's no guarantee that your snaps become publicly viewable), live stories like these also appear for specific events.

What is Snapchat Discover?

The same screen that displays users' stories and live stories also features a 'discover' section. Here you'll find content from big brands and media outlets specifically created for Snapchat. Discover channels deliver stories, news, entertainment and serve as the Snapchat equivalent of a dedicated news feed. You can watch a story on Discover for 24 hours before it is replaced by the next day's coverage. The sources that supply discover stories can change over time and based on your location.

What else can Snapchat do?

You don't have to send pictures and videos to your friends on Snapchat all the time. Once a private conversation has started you can continue the conversation like a more conventional messaging app, with standalone text or in the form of a video call if you prefer.

In the US, users also have access to a feature called Snapcash, where you can actually send real money to your Snapchat friends through the app, whilst users under the age of 13 can only access a restricted version of the app called SnapKidz, which lets them take photos and videos, apply filters, drawings, and stickers, but lacks the social sharing component of the standard app.

Snapchat ghosts

Fun fact, the ghost that appears on the Snapchat icon is called Ghostface Chillah, a play on rapper Ghostface Killah – a member of the Wu-Tang Clan.

Each of Snapchat's major updates is named after a famous ghost. At the time of writing, the most recent update was named Banquo.

You can download Snapchat for free on iOS here and Android here.

Last update (9/11/16): Added imagery information regarding what World Lenses are and how they work.

                            <meta itemprop="name" content="Recombu">

                    Do you like this article?

Tweet

You should also read

        Snapchat Discover launches, brings current affairs to your phone

        Snapchat Spectacles finally coming to Europe, June 2nd: How to find them/where to buy

        Snapchat's new creative tools: All you need to know

        What is Pokémon GO? The new AR mobile game explained

        How to update your Android phone to Android O

        How to watch VR videos and play VR games on your Android phone

        How to get cheap or free Internet on your phone or tablet when travelling abroad

        How to download movies and TV shows to your iPhone, iPad or Android phone

Join the conversation

View the discussion thread.

You should also read

                1
Snapchat Discover launches, brings current affairs to your phone

                2
Snapchat Spectacles finally coming to Europe, June 2nd: How to find them/where to buy

                3
Snapchat's new creative tools: All you need to know

                4
What is Pokémon GO? The new AR mobile game explained

                5
How to update your Android phone to Android O

Be the first to know

Sign up to our newsletter and be the first to hear about exclusive competitions, the best deals and the latest news

    <form action="/digital/ajax/newsletter-signup" id="newsletter-signup" method="post" novalidate="novalidate">

            <input type="text" name="Email" value="" placeholder="Enter email..."/>
            <input type="submit" value="Subscribe" />

    </form>

Most read

                1
Best budget camera phones 2017: The greatest mobile snappers for £299 and under

                2
Best Sony Xperia phones right now and still coming in 2017

                3
How to add extra storage to the Google Pixel and Pixel XL phones

                4
When is the next Apple launch event and what will be launched?

                5
Art of Conquest (iOS/Android) Tips and Tricks Guide: Conquer this mobile strategy game

Latest Reviews

                1
Vodafone Smart V8 Review: In Depth

                2
Honor 9 Review: Watch out, OnePlus

                3
Microsoft Surface Pro (2017) Review: In Depth

                4
OnePlus 5 Review: Can OnePlus win our 'best phone' award again?

                5
Vodafone Smart N8 Review: A great, affordable family phone

Suggested Reading

iPhone 7 and iPhone 7 Plus tips, tricks and hidden features: Get the most from your iPhone

Best Android phones in 2017: We review the greatest Android mobiles out now

Mobile Phones Coming Soon: The best new phones launching in 2017

When is the next Apple launch event and what will be launched?

What is Pokémon: Magikarp Jump? How to download and play

Neko Atsume tips & tricks: How to get free gold and silver fish, cheats, hacks and more

Best Sony Xperia phones right now and still coming in 2017

3D Touch not working on your iPhone? How to configure 3D Touch in iOS

Pokemon Go tips and tricks: A complete guide to the 'Gen 2' update

Pokédex For Pokémon GO – All The Pokémon You Can Catch Or Evolve

Read next

    ×

Snapchat Discover launches, brings current affairs to your phone

Back to top ↑

Mobile Phones

 News

 Reviews

 Videos

 Deals

Broadband & TV

 Providers

 News

 Speed Test

 Compare

 Deals

Cars

 News

 Reviews

 Videos

Follow Recombu

 Facebook

 Twitter

 Google+

 YouTube

About us

Work with us

Contact us

Meet the team

Awards

Terms & Conditions

Privacy Policy

Cookie Policy

Copyright © Recombu 2017. All rights reserved.


text:
import { css, SerializedStyles } from '@emotion/react';
import styled from '@emotion/styled';
import { darken, rem } from 'polished';
import { centerGridOne, NetWorthValueFX } from '~client/components/form-field/styles';
import { ModalDialog } from '~client/components/modal-dialog/styles';
import {
  CategoryItemForm,
  ToggleVisibility,
} from '~client/components/net-worth/category-list/styles';
import {
  EditCurrency,
  EditByCategory,
  AddByCategoryValue,
  FormContainer as NetWorthEditForm,
} from '~client/components/net-worth/edit-form/styles';
import { breakpoint } from '~client/styled/mixins';
import { breakpoints, colors } from '~client/styled/variables';

type ButtonProps = {
  expanded?: boolean;
};
const buttonStyles = ({ expanded = false }: ButtonProps): SerializedStyles => css`
  display: flex;
  margin: 0 6px;
  flex-grow: 1;
  justify-content: center;
  padding: ${rem(8)};
  width: 100%;
  background: ${colors.button.mobile};
  font-size: 0.6em;
  border: none;
  border-radius: 3px;
  outline: none;
  text-transform: uppercase;
  font-weight: bold;

  ${CategoryItemForm} & {
    ${centerGridOne};
    grid-column: 4;
  }

  ${ToggleVisibility} & {
    &,
    &:hover,
    &:active {
      background: none;
      border: none;
      box-shadow: none;
    }

    &::after {
      display: block;
      margin-left: 16px;
      content: '';
      width: 0;
      height: 0;
      border: solid transparent;
      border-left-color: ${colors.dark.dark};
      border-width: 6px 8px;
      transform-origin: left center;
      ${expanded &&
      css`
        transform: rotate(90deg);
      `};
    }
  }

  &:disabled {
    background: none;
  }

  ${breakpoint(breakpoints.mobile)} {
    display: inline-block;
    margin: 0;
    padding: 5px 12px 6px;
    flex-grow: 0;
    width: auto;
    background: ${colors.button.main};
    border-radius: ${rem(3)};
    cursor: pointer;
    color: ${colors.white};
    font-family: Arial;
    font-size: ${rem(13)};
    position: relative;
    text-decoration: none;
    text-transform: none;
    z-index: 4;

    &:hover,
    &:focus {
      background: ${colors.button.focus};
    }
    &:active {
      background: ${colors.button.active};
    }
    &:disabled {
      background: ${colors.button.disabled};
      cursor: default;
    }
  }

  ${EditCurrency} & {
    margin: 2px 4px;
  }
`;

export const Button = styled.button<ButtonProps>(buttonStyles);

const defaultButtonSize = 22;

type ButtonCrudProps = { size?: number };

const ButtonCrud = styled(Button)<ButtonCrudProps>(
  ({ size = defaultButtonSize }) => css`
    ${AddByCategoryValue} &,
  ${EditByCategory} & {
      margin: 0 5px;
      flex: 0 0 auto;
    }
    ${NetWorthValueFX} & {
      margin: 0 3px;
      top: 0;
      flex: 0 0 ${rem(size)};
    }
  `,
);

const deleteStyles = (size: number): SerializedStyles => css`
  display: inline-flex;
  margin: 0;
  padding: 0;
  align-items: center;
  justify-content: center;
  width: ${rem(size)};
  height: ${rem(size)};
  font-size: ${rem(size - 4)};
  line-height: ${rem(size)};
  background: ${colors.delete};
  border-radius: 100%;
  border: none;
  box-shadow: none;
  color: ${colors.white};
`;

export const ButtonDelete = styled(ButtonCrud)<ButtonCrudProps>(
  ({ size = defaultButtonSize }) => css`
    ${deleteStyles(size)};
    ${breakpoint(breakpoints.mobile)} {
      ${deleteStyles(size)};
    }

    ${breakpoint(breakpoints.mobile)} {
      &:focus,
      &:hover {
        background: ${darken(0.1)(colors.delete)};
        &:active {
          background: ${darken(0.2)(colors.delete)};
        }
      }
    }

    ${CategoryItemForm} > & {
      grid-row: 1;
      grid-column: 3;
    }
    ${NetWorthEditForm} & {
      border-radius: 2px;
      font-size: ${rem(14)};
      padding: 0 ${rem(8)};
      text-transform: none;
      width: auto;
    }
    ${EditCurrency} & {
      grid-column: 4;
      margin: 0;
    }
    ${AddByCategoryValue} & {
      grid-column: 4;
    }
  `,
);

export const ButtonAdd = styled(ButtonDelete)`
  background: ${colors.create};
  ${breakpoint(breakpoints.mobile)} {
    background: ${colors.create};
  }
  ${breakpoint(breakpoints.mobile)} {
    &:focus,
    &:hover {
      background: ${darken(0.1)(colors.create)};
      &:active {
        background: ${darken(0.2)(colors.create)};
      }
    }
  }
`;

export const ButtonCancel = styled(Button)`
  ${ModalDialog} & {
    background: ${colors.light.mediumDark};
    color: ${colors.black};
    &::after {
      display: block;
      content: '';
      height: 100%;
      width: 0;
    }
  }

  ${NetWorthEditForm} & {
    flex: 0 0 auto;
    margin: ${rem(4)} auto;
    padding: ${rem(8)} ${rem(16)};
    width: auto;

    ${breakpoint(breakpoints.mobile)} {
      margin: 0;
      padding: 0 ${rem(16)};
    }
  }

  ${breakpoint(breakpoints.mobile)} {
    position: absolute;
    left: 0;
    top: 0;
  }
`;

export const ButtonRefresh = styled(Button)`
  ${EditCurrency} & {
    border-radius: 100%;
    grid-column: 3;
    height: ${rem(24)};
    line-height: ${rem(24)};
    margin: 0;
    padding: 0;
    width: ${rem(24)};
  }
`;

export const ButtonSubmit = styled(Button)`
  ${ModalDialog} & {
    background: ${colors.blue};
    color: ${colors.white};
  }
`;


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package uk.co.atgsoft.caveman.wine;

/**
 *
 * @author adam.gillmore
 */
public enum WineColour {

    RED,

    WHITE,

    ROSE
}