diff --git a/app/assets/javascripts/initializers/initScrolling.js b/app/assets/javascripts/initializers/initScrolling.js
index 352fe4f91..184052974 100644
--- a/app/assets/javascripts/initializers/initScrolling.js
+++ b/app/assets/javascripts/initializers/initScrolling.js
@@ -105,7 +105,7 @@ function buildTagsHTML(tag) {
var antifollow = '';
if (tag.points < 0) {
antifollow =
- 'Anti-follow';
+ 'Anti-follow';
}
return `
diff --git a/app/assets/stylesheets/components/header.scss b/app/assets/stylesheets/components/header.scss
index 1c0ffeaad..01d6a97a4 100644
--- a/app/assets/stylesheets/components/header.scss
+++ b/app/assets/stylesheets/components/header.scss
@@ -24,7 +24,7 @@
height: var(--header-height);
}
- .crayons-indicator {
+ .c-indicator {
position: absolute;
top: calc(var(--su-1) * -1);
right: 0;
diff --git a/app/assets/stylesheets/components/indicators.scss b/app/assets/stylesheets/components/indicators.scss
index 22cfbd1a7..433bc6fb9 100644
--- a/app/assets/stylesheets/components/indicators.scss
+++ b/app/assets/stylesheets/components/indicators.scss
@@ -1,60 +1,39 @@
-@import '../config/import';
-
-// indicator() - Generates styles for Indicators
-//
-// Indicators have bunch of styles combines with bunch of states. To make
-// it easier to generate all these classes, we created a help which should
-// do the job.
-//
-// @param {object} $this Cached variable with parent element
-// @param {string} $name Value for border-radius
-// @param {color} $color-1 Main color.
-
-@mixin indicator($this, $name, $color-1, $color-2) {
- {'--' + $name} {
- background-color: $color-1;
- border-color: $color-1;
- color: $color-2;
-
- {$this + '--outlined'} {
- background-color: transparent;
- color: $color-1;
- border-color: $color-1;
- }
- }
-}
-
-// Basic styling
-.crayons-indicator {
- font-family: var(--ff-monospace);
- font-size: var(--fs-xs);
+.c-indicator {
+ --bg: var(--badge-bg);
+ --color: var(--badge-color);
padding: var(--su-1);
- background-color: var(--indicator-default-bg);
- border: 1px solid var(--indicator-default-bg);
- color: var(--indicator-default-color);
text-align: center;
line-height: 1;
+ font-size: var(--fs-s);
border-radius: var(--radius);
display: inline-block;
+ background: var(--bg);
+ color: var(--color);
+ min-width: var(--su-2);
- &--outlined {
- background-color: transparent;
- border-color: var(--indicator-default-bg);
- color: var(--indicator-default-color);
+ &--success {
+ --bg: var(--badge-success-bg);
+ --color: var(--badge-success-color);
}
- @include indicator(
- &,
- accent,
- var(--indicator-accent-bg),
- var(--indicator-accent-color)
- );
- @include indicator(
- &,
- critical,
- var(--indicator-critical-bg),
- var(--indicator-critical-color)
- );
+ &--warning {
+ --bg: var(--badge-warning-bg);
+ --color: var(--badge-warning-color);
+ }
+
+ &--danger {
+ --bg: var(--badge-danger-bg);
+ --color: var(--badge-danger-color);
+ }
+
+ &--info {
+ --bg: var(--badge-info-bg);
+ --color: var(--badge-info-color);
+ }
+
+ &--relaxed {
+ padding: var(--su-2);
+ }
&:empty {
display: none;
diff --git a/app/assets/stylesheets/components/navigation.scss b/app/assets/stylesheets/components/navigation.scss
index a58690bfd..5d26226e5 100644
--- a/app/assets/stylesheets/components/navigation.scss
+++ b/app/assets/stylesheets/components/navigation.scss
@@ -88,7 +88,7 @@
font-size: var(--fs-xl);
}
- .crayons-indicator {
+ .c-indicator {
margin-left: auto;
&:empty {
diff --git a/app/assets/stylesheets/config/_colors.css b/app/assets/stylesheets/config/_colors.css
index 6051fcc18..a8c2c0ae5 100644
--- a/app/assets/stylesheets/config/_colors.css
+++ b/app/assets/stylesheets/config/_colors.css
@@ -307,6 +307,30 @@ of particular colors in components and views.
--cta-branded-border: var(--accent-brand);
--cta-branded-border-hover: var(--accent-brand-darker);
+ /***********************************************
+ ** Badges **************************************
+ ***********************************************/
+
+ /* Badges: Default */
+ --badge-bg: var(--base-30);
+ --badge-color: var(--base-80);
+
+ /* Badges: Success */
+ --badge-success-bg: var(--accent-success);
+ --badge-success-color: rgb(0,0,0);
+
+ /* Badges: Warning */
+ --badge-warning-bg: var(--accent-warning);
+ --badge-warning-color: rgb(0,0,0);
+
+ /* Badges: Danger */
+ --badge-danger-bg: var(--accent-danger);
+ --badge-danger-color: rgb(255,255,255);
+
+ /* Badges: Info */
+ --badge-info-bg: var(--accent-brand);
+ --badge-info-color: rgb(255,255,255);
+
/***********************************************
** Utilities ***********************************
***********************************************/
diff --git a/app/assets/stylesheets/settings.scss b/app/assets/stylesheets/settings.scss
index 83e741bf5..9b99ef451 100755
--- a/app/assets/stylesheets/settings.scss
+++ b/app/assets/stylesheets/settings.scss
@@ -34,7 +34,7 @@
justify-content: space-between;
font-weight: var(--fw-medium);
- .crayons-indicator {
+ .c-indicator {
margin-left: 5px;
}
button {
diff --git a/app/assets/stylesheets/themes/dark.css b/app/assets/stylesheets/themes/dark.css
index 57123771c..fae8cc926 100644
--- a/app/assets/stylesheets/themes/dark.css
+++ b/app/assets/stylesheets/themes/dark.css
@@ -256,6 +256,18 @@
--cta-branded-border: var(--accent-brand);
--cta-branded-border-hover: var(--accent-brand-lighter);
+ /***********************************************
+ ** Badges **************************************
+ ***********************************************/
+
+ /* Badges: Danger */
+ --badge-danger-bg: var(--accent-danger-darker);
+ --badge-danger-color: rgb(255,255,255);
+
+ /* Badges: Info */
+ --badge-info-bg: var(--accent-brand-darker);
+ --badge-info-color: rgb(255,255,255);
+
/***********************************************
** Utilities ***********************************
***********************************************/
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 5247e0641..7dec2afce 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -272,7 +272,7 @@ module ApplicationHelper
if method.to_sym.in?(Settings::Mandatory.keys)
required = tag.span(I18n.t("helpers.application_helper.required"),
- class: "crayons-indicator crayons-indicator--critical")
+ class: "c-indicator c-indicator--danger")
content = safe_join([content, required])
end
diff --git a/app/javascript/crayons/Indicator/__stories__/indicator.html.stories.jsx b/app/javascript/crayons/Indicator/__stories__/indicator.html.stories.jsx
deleted file mode 100644
index c6743181e..000000000
--- a/app/javascript/crayons/Indicator/__stories__/indicator.html.stories.jsx
+++ /dev/null
@@ -1,106 +0,0 @@
-import { h } from 'preact';
-import notes from './indicators.mdx';
-
-export default {
- title: 'Components/Indicators',
- parameters: {
- docs: {
- page: notes,
- },
- },
-};
-
-export const Default = () =>
Label;
-Default.story = { name: 'default (grey)' };
-
-export const GreyOutlined = () => (
-
- Outlined
-
-);
-
-GreyOutlined.story = {
- name: 'grey outlined',
-};
-
-export const GreyWithNumber = () => (
-
1
-);
-
-GreyWithNumber.story = {
- name: 'grey with number',
-};
-
-export const Accent = () => (
-
Label
-);
-
-Accent.story = {
- name: 'accent',
-};
-
-export const AccentOutlined = () => (
-
- Outlined
-
-);
-
-AccentOutlined.story = { name: 'accent outlined' };
-
-export const AccentWithNumber = () => (
-
1
-);
-
-AccentWithNumber.story = {
- name: 'accent with number',
-};
-
-export const Critical = () => (
-
Label
-);
-
-Critical.story = {
- name: 'critical',
-};
-
-export const CriticalOutline = () => (
-
- Outlined
-
-);
-
-CriticalOutline.story = {
- name: 'critical outline',
-};
-
-export const CriticalWithNumber = () => (
-
1
-);
-
-CriticalWithNumber.story = {
- name: 'critical with number',
-};
-
-export const Inverted = () => (
-
Label
-);
-
-Inverted.story = { name: 'inverted' };
-
-export const InvertedOutlined = () => (
-
- Outlined
-
-);
-
-InvertedOutlined.story = {
- name: 'inverted outlined',
-};
-
-export const InvertedWithNumber = () => (
-
1
-);
-
-InvertedWithNumber.story = {
- name: 'inverted with number',
-};
diff --git a/app/javascript/crayons/Indicator/__stories__/indicators.mdx b/app/javascript/crayons/Indicator/__stories__/indicators.mdx
deleted file mode 100644
index c7d18c43b..000000000
--- a/app/javascript/crayons/Indicator/__stories__/indicators.mdx
+++ /dev/null
@@ -1,23 +0,0 @@
-## Indicators
-
-Indicators are meant to be used to inform user about, for example, unread
-notifications. They supposed to steal user's attention and make him notice
-or click specific element.
-
-We should keep in mind to never show too many indicators at the same time. Use
-your best judgment. There are two types of indicators:
-
-- Rectangle with label (text or number)
-- Bullet - just a circle without any text on it.
-
-And there arere four styles to pick from:
-
-- Default (grey) - nothing really crucial, basic information about something.
-
-- Accent (blueish) - something we want user to be aware of but it's also
- not crucial information
-
-- Critical (red) - something super important, don't overuse it!!
-
-- Inverted (dark grey) - alternative to the default one, especially when we need
- to show two default indicators next to each other.
diff --git a/app/javascript/crayons/Indicators/Indicator.jsx b/app/javascript/crayons/Indicators/Indicator.jsx
new file mode 100644
index 000000000..2876c6bbc
--- /dev/null
+++ b/app/javascript/crayons/Indicators/Indicator.jsx
@@ -0,0 +1,31 @@
+import { h } from 'preact';
+import PropTypes from 'prop-types';
+import classNames from 'classnames/bind';
+
+export const Indicator = ({
+ children,
+ variant = 'default',
+ extraPadding,
+ className,
+ ...otherProps
+}) => {
+ const classes = classNames('c-indicator', {
+ [`c-indicator--${variant}`]: variant && variant !== 'default',
+ 'p-2': extraPadding,
+ [className]: className,
+ });
+
+ return (
+
+ {children}
+
+ );
+};
+
+Indicator.displayName = 'Indicator';
+
+Indicator.propTypes = {
+ variant: PropTypes.oneOf(['default', 'info', 'success', 'warning', 'danger']),
+ className: PropTypes.string,
+ extraPadding: PropTypes.bool,
+};
diff --git a/app/javascript/crayons/Indicators/__stories__/Indicators.mdx b/app/javascript/crayons/Indicators/__stories__/Indicators.mdx
new file mode 100644
index 000000000..d30e4993f
--- /dev/null
+++ b/app/javascript/crayons/Indicators/__stories__/Indicators.mdx
@@ -0,0 +1,39 @@
+# Indicators
+
+Indicators are meant to be used to inform user about, for example, unread
+notifications. They supposed to steal user's attention and make them notice
+or click specific element.
+
+We should keep in mind to never show too many indicators at the same time. Use
+your best judgment here.
+
+## Variants
+
+There's a bunch of variants (styles) to pick from:
+
+- Default - grey.
+- Info - blue-ish.
+- Success - green.
+- Warninig - yellow.
+- Danger - red.
+
+Even though they are named specifically, they don't really come with any function in mind - main difference is basically a color.
+
+## Padding
+
+By default, Indicator has very tight padding around label - `4px`. It's ok for short labels - like a number.
+But for longer labels it may look better with some extra spacing. And there comes `extraPadding` prop which will increase the padding to `8px`.
+
+Keep in mind, Indicators can inherit any classes like every other element which means you can (if you have to) increase that padding manually
+with, for example, `p-*` utility classes.
+
+## Design
+
+
+ Comparing designs with what's in the Storybook you may notice differences in colors.
+ This is due to the fact that Figma already reflects new colors palette which is not yet reflected in the codebase
+ (it's currently being reviewed in a separate PR).
+
+
+
+
diff --git a/app/javascript/crayons/Indicators/__stories__/Indicators.stories.jsx b/app/javascript/crayons/Indicators/__stories__/Indicators.stories.jsx
new file mode 100644
index 000000000..64bf33724
--- /dev/null
+++ b/app/javascript/crayons/Indicators/__stories__/Indicators.stories.jsx
@@ -0,0 +1,75 @@
+import { h } from 'preact';
+import { Indicator } from '../';
+import IndicatorsDoc from './Indicators.mdx';
+
+export default {
+ component: Indicator,
+ title: 'Components/Indicators',
+ parameters: {
+ docs: {
+ page: IndicatorsDoc,
+ },
+ },
+ argTypes: {
+ variant: {
+ control: {
+ type: 'select',
+ options: {
+ default: undefined,
+ info: 'info',
+ success: 'success',
+ warning: 'warning',
+ danger: 'danger',
+ },
+ },
+ description:
+ 'There are bunch of available variants (styles) to pick from. The primary difference is color but each color should be used for different purpose. Read Docs for more info.',
+ table: {
+ defaultValue: { summary: 'default' },
+ },
+ },
+ extraPadding: {
+ description:
+ 'Indicators are "tight" by default which means they have very little padding. This will gently increase the padding so it looks more loose.',
+ table: {
+ defaultValue: { summary: false },
+ },
+ },
+ },
+};
+
+export const Default = (args) =>
;
+Default.args = {
+ children: 'Hello world',
+};
+
+export const VariantInfo = (args) =>
;
+VariantInfo.args = {
+ ...Default.args,
+ variant: 'info',
+};
+
+export const VariantSuccess = (args) =>
;
+VariantSuccess.args = {
+ ...Default.args,
+ variant: 'success',
+};
+
+export const VariantWarning = (args) =>
;
+VariantWarning.args = {
+ ...Default.args,
+ variant: 'warning',
+};
+
+export const VariantDanger = (args) =>
;
+VariantDanger.args = {
+ ...Default.args,
+ variant: 'danger',
+};
+
+export const ExtraPadding = (args) =>
;
+ExtraPadding.args = {
+ ...Default.args,
+ extraPadding: true,
+ children: 'Hello world',
+};
diff --git a/app/javascript/crayons/Indicators/index.js b/app/javascript/crayons/Indicators/index.js
new file mode 100644
index 000000000..717dbf3a0
--- /dev/null
+++ b/app/javascript/crayons/Indicators/index.js
@@ -0,0 +1 @@
+export * from './Indicator';
diff --git a/app/javascript/githubRepos/singleRepo.jsx b/app/javascript/githubRepos/singleRepo.jsx
index 671020fff..a417cdbdf 100644
--- a/app/javascript/githubRepos/singleRepo.jsx
+++ b/app/javascript/githubRepos/singleRepo.jsx
@@ -12,11 +12,7 @@ export class SingleRepo extends Component {
forkLabel = () => {
const { fork } = this.props;
if (fork) {
- return (
-
- fork
-
- );
+ return
fork;
}
return null;
};
diff --git a/app/views/admin/navigation_links/index.html.erb b/app/views/admin/navigation_links/index.html.erb
index 6c1ca75c0..be7bf3031 100644
--- a/app/views/admin/navigation_links/index.html.erb
+++ b/app/views/admin/navigation_links/index.html.erb
@@ -15,7 +15,7 @@
<%= link[:icon].html_safe %>
- <%= link[:name] %>
+ <%= link[:name] %>
@@ -45,7 +45,7 @@