Skip to content

Commit

Permalink
feat(ProgressBottomBar): new component
Browse files Browse the repository at this point in the history
fix(TextEditor): readOnly refresh
feat(ComputerKeyboardNext): change SVG
fix(Accordion): set hover color to transparent
  • Loading branch information
fermarinsanchez committed Jan 17, 2024
1 parent fdbee7f commit 1b25ecc
Show file tree
Hide file tree
Showing 13 changed files with 247 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createStyles } from '@mantine/styles';
import { pxToRem, getPaddings, getFontExpressive, getFontProductive } from '../../theme.mixins';
import { pxToRem } from '../../theme.mixins';

const BORDER_RADIUS = 8;

export const ActivityAccordionStyles = createStyles((theme, { compact }) => {
const ActivityAccordionStyles = createStyles((theme, { compact }) => {
const PANEL_COLORS = {
default: theme.colors.uiBackground01,
solid: theme.colors.interactive03h,
Expand All @@ -14,6 +14,9 @@ export const ActivityAccordionStyles = createStyles((theme, { compact }) => {
display: 'flex',
flexDirection: 'column',
gap: theme.spacing[2],
'& .mantine-Accordion-control:hover': {
backgroundColor: 'transparent',
},
},
item: {
backgroundColor: theme.colors.uiBackground01,
Expand Down Expand Up @@ -54,3 +57,5 @@ export const ActivityAccordionStyles = createStyles((theme, { compact }) => {
},
};
});

export { ActivityAccordionStyles };
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import propTypes from 'prop-types';

export const PROGRESSBOTTOMBAR_RADIUS = ['xs', 'sm', 'md', 'lg', 'xl'];
export const PROGRESSBOTTOMBAR_SIZES = ['xs', 'sm', 'md', 'lg', 'xl'];

// SECTIONS PROP EXAMPLE
// If you want to use sections prop, you need to pass an array of objects with value, color and label keys.
// only value and color keys are required.
//
// sections={[
// { value: 33, color: 'pink', label: 'Documents', tooltip: 'Document – 33 Gb' },
// { value: 28, color: 'grape', label: 'Apps', tooltip: 'Apps – 28 Gb' },
// { value: 25, color: 'violet', label: 'Other', tooltip: 'Other – 25 Gb' },
// ]}

export const PROGRESSBOTTOMBAR_DEFAULT_PROPS = {
animate: false,
color: 'orange',
label: '',
labelLeft: 'labelLeft',
labelRight: 'LabelRight',
radius: 'lg',
sections: null,
size: 'sm',
striped: false,
value: 100,
};

export const PROGRESSBOTTOMBAR_PROP_TYPES = {
animate: propTypes.bool,
color: propTypes.string,
label: propTypes.string,
labelLeft: propTypes.string,
labelRight: propTypes.string,
radius: propTypes.oneOf(PROGRESSBOTTOMBAR_RADIUS),
sections: propTypes.array,
size: propTypes.oneOf(PROGRESSBOTTOMBAR_SIZES),
striped: propTypes.bool,
value: propTypes.number,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import React from 'react';
import { Progress as MantineProgress } from '@mantine/core';
import { Box, Text } from '@bubbles-ui/components';
import {
PROGRESSBOTTOMBAR_DEFAULT_PROPS,
PROGRESSBOTTOMBAR_PROP_TYPES,
} from './ProgressBottomBar.constants';
import { ProgressBottomBarStyles } from './ProgressBottomBar.styles';

const ProgressBottomBar = ({
animate,
label,
labelTop,
color,
radius,
sections,
size,
striped,
value,
}) => {
const { classes, theme } = ProgressBottomBarStyles();
return (
<Box>
{labelTop && (
<Box className={classes.topLabelContainer}>
<Text className={classes.labelTop}>{labelTop}</Text>
</Box>
)}
<MantineProgress
value={value}
label={label}
color={'#4D5358'}
animate={animate}
radius={radius}
sections={sections}
size={size}
striped={striped}
/>
</Box>
);
};

ProgressBottomBar.propTypes = PROGRESSBOTTOMBAR_PROP_TYPES;
ProgressBottomBar.defaultProps = PROGRESSBOTTOMBAR_DEFAULT_PROPS;
ProgressBottomBar.displayName = 'ProgressBottomBar';

export { ProgressBottomBar };
export default ProgressBottomBar;
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Story, Props, Source, Preview } from '@storybook/addon-docs';
import * as stories from './ProgressBottomBar.stories.js';
import { ProgressBottomBar } from './ProgressBottomBar.js';
import { ThemeProvider } from './../../ThemeProvider';

# ChatMessage

[Source code](https://github.com/leemonade/bubbles/tree/main/packages/components/src/informative/ChatMessage/ChatMessage.js)

## Table of Contents

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Overview](#overview)
{/* - [ProgessColorBar options](#ProgessColorBar-options) */}
- [Component API](#component-api)
- [Feedback](#feedback)

## Overview

ChatMessage is a component used to display a message from an user.


## ChatMessage options



## Feedback

Help us improve this component by providing feedback, asking questions on Slack, or updating this file on
[GitHub](https://github.com/leemonade/bubbles/edit/main/packages/components/src/informative/ProgressBottomBar/ProgressBottomBar.mdx)
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import React from 'react';
import { ProgressBottomBar } from './ProgressBottomBar';
import mdx from './ProgressBottomBar.mdx';
import { Box } from '../../layout';
import { PROGRESSBOTTOMBAR_RADIUS, PROGRESSBOTTOMBAR_SIZES } from './ProgressBottomBar.constants';

export default {
title: 'Atoms/Informative/ProgressBottomBar',
parameters: {
component: ProgressBottomBar,
docs: {
page: mdx,
},
design: {
type: 'figma',
// url: 'https://www.figma.com/file/c3MWm2gVHU4JfYlVfr5VvB/🍋💧-Bubbles-SD-v2?node-id=3639%3A28963',
},
},
argTypes: {
animate: {
control: {
type: 'boolean',
},
},
color: {
control: {
type: 'color',
},
},
radius: {
control: {
type: 'select',
options: PROGRESSBOTTOMBAR_RADIUS,
},
},
size: {
control: {
type: 'select',
options: PROGRESSBOTTOMBAR_SIZES,
},
},
striped: {
control: {
type: 'boolean',
},
},
label: {
control: {
type: 'text',
},
},
labelLeft: {
control: {
type: 'text',
},
},
labelRight: {
control: {
type: 'text',
},
},
},
};

const Template = ({ ...props }) => (
<Box style={{ maxWidth: '300px' }}>
<ProgressBottomBar {...props} />
</Box>
);

export const Playground = Template.bind({});

Playground.args = {
animate: false,
value: 50,
size: 'lg',
radius: 'lg',
striped: false,
color: 'orange',
label: '',
labelTop: 'labelTop',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { createStyles } from '@mantine/styles';
import { pxToRem } from '../../theme.mixins';

const ProgressBottomBarStyles = createStyles((theme) => ({
topLabelContainer: {
display: 'flex',
justifyContent: 'center',
marginBottom: pxToRem(8),
},
labelTop: {
color: theme.other.progress.content.color.text,
...theme.other.progress.content.typo,
},
}));

export { ProgressBottomBarStyles };
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './ProgressBottomBar';
1 change: 1 addition & 0 deletions packages/components/src/informative/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export * from './UserCards';
export * from './UserDisplayItemList';
export * from './ChatMessage';
export * from './ProgressColorBar';
export * from './ProgressBottomBar';
export * from './ProgressRing';
5 changes: 5 additions & 0 deletions packages/editors/src/form/TextEditor/TextEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,16 @@ const TextEditor = ({
if (isFunction(onSchemaChange) && useSchema) onSchemaChange(getEditorJson());
};

const dispatchSchema = () => {
if (isFunction(onSchemaChange) && useSchema) onSchemaChange(getEditorJson());
};

useEffect(() => {
if (!editor) return;
if (!isEqual(content, store.current.content)) {
store.current.content = content;
editor.commands.setContent(content || '');
dispatchSchema();
}
}, [editor, content]);

Expand Down
4 changes: 2 additions & 2 deletions packages/icons/optimized/outline/computer-keyboard-next.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions packages/icons/outline/ComputerKeyboardNextIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ const React = require("react");
function ComputerKeyboardNextIcon(props) {
return /*#__PURE__*/React.createElement("svg", Object.assign({
fill: "none",
viewBox: "0 0 17 16",
viewBox: "0 0 18 18",
stroke: "currentColor",
"aria-hidden": "true",
width: "1em",
height: "1em"
}, props), /*#__PURE__*/React.createElement("path", {
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: 1.6,
d: "M10.8 8H1.2M6.8 12l4-4-4-4M15.6 4v8"
fill: "#343A3F",
fillRule: "evenodd",
d: "M16.447 9.076a.448.448 0 0 1-.145.27.448.448 0 0 1-.198.126c-.035.013-.159.014-4.413.015l-4.378.002.933.934.934.934.033.069a.49.49 0 0 1-.008.46.493.493 0 0 1-.65.2l-.061-.029-1.39-1.39C5.746 9.31 5.712 9.275 5.686 9.223A.45.45 0 0 1 5.636 9a.45.45 0 0 1 .05-.224c.027-.052.06-.087 1.414-1.44C8.612 5.822 8.51 5.918 8.634 5.88a.396.396 0 0 1 .14-.017c.1 0 .161.015.242.06a.619.619 0 0 1 .189.188.49.49 0 0 1 .008.461l-.033.069-.934.934-.933.934 4.378.002c4.254.001 4.378.002 4.413.015a.448.448 0 0 1 .198.127c.074.074.103.12.129.204a.626.626 0 0 1 .015.218Zm-13.92 7.577a.48.48 0 0 1-.118.236.485.485 0 0 1-.714.018.37.37 0 0 1-.09-.125.728.728 0 0 1-.043-.107c-.014-.06-.014-15.292 0-15.35a.725.725 0 0 1 .042-.107.499.499 0 0 1 .309-.256.497.497 0 0 1 .6.322l.019.058.001 7.64c0 4.304-.002 7.653-.005 7.67Z",
clipRule: "evenodd"
}));
}
module.exports = ComputerKeyboardNextIcon;
10 changes: 5 additions & 5 deletions packages/icons/outline/esm/ComputerKeyboardNextIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import * as React from "react";
function ComputerKeyboardNextIcon(props) {
return /*#__PURE__*/React.createElement("svg", Object.assign({
fill: "none",
viewBox: "0 0 17 16",
viewBox: "0 0 18 18",
stroke: "currentColor",
"aria-hidden": "true",
width: "1em",
height: "1em"
}, props), /*#__PURE__*/React.createElement("path", {
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: 1.6,
d: "M10.8 8H1.2M6.8 12l4-4-4-4M15.6 4v8"
fill: "#343A3F",
fillRule: "evenodd",
d: "M16.447 9.076a.448.448 0 0 1-.145.27.448.448 0 0 1-.198.126c-.035.013-.159.014-4.413.015l-4.378.002.933.934.934.934.033.069a.49.49 0 0 1-.008.46.493.493 0 0 1-.65.2l-.061-.029-1.39-1.39C5.746 9.31 5.712 9.275 5.686 9.223A.45.45 0 0 1 5.636 9a.45.45 0 0 1 .05-.224c.027-.052.06-.087 1.414-1.44C8.612 5.822 8.51 5.918 8.634 5.88a.396.396 0 0 1 .14-.017c.1 0 .161.015.242.06a.619.619 0 0 1 .189.188.49.49 0 0 1 .008.461l-.033.069-.934.934-.933.934 4.378.002c4.254.001 4.378.002 4.413.015a.448.448 0 0 1 .198.127c.074.074.103.12.129.204a.626.626 0 0 1 .015.218Zm-13.92 7.577a.48.48 0 0 1-.118.236.485.485 0 0 1-.714.018.37.37 0 0 1-.09-.125.728.728 0 0 1-.043-.107c-.014-.06-.014-15.292 0-15.35a.725.725 0 0 1 .042-.107.499.499 0 0 1 .309-.256.497.497 0 0 1 .6.322l.019.058.001 7.64c0 4.304-.002 7.653-.005 7.67Z",
clipRule: "evenodd"
}));
}
export default ComputerKeyboardNextIcon;
15 changes: 3 additions & 12 deletions packages/icons/src/outline/computer-keyboard-next.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1b25ecc

Please sign in to comment.