Skip to content

Commit

Permalink
add resposive layout (#385)
Browse files Browse the repository at this point in the history
* chore(): responsive layout

* chore(): fix tslint errors

* chore(): add sidebar toggler

* chore(): fix circleci

* chore(): fulfill review requests
  • Loading branch information
SeverS committed Jan 29, 2020
1 parent 8dbe6a8 commit 8ce113e
Show file tree
Hide file tree
Showing 50 changed files with 490 additions and 549 deletions.
2 changes: 1 addition & 1 deletion examples/ui/feed-app/package.json
Expand Up @@ -5,7 +5,7 @@
"dependencies": {},
"peerDependencies": {},
"scripts": {
"start": "webpack-dev-server --config ./webpack.config.js --port 8131",
"start": "webpack-dev-server --config ./webpack.config.js --port 8131 --host 0.0.0.0",
"prepare": "tsc --build",
"prestart": "tsc --build",
"build:staging": "webpack --config ./webpack.config.js"
Expand Down
2 changes: 1 addition & 1 deletion examples/ui/feed-app/public/index.html
Expand Up @@ -47,5 +47,5 @@
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<script type="text/javascript" src="/akasha.runtime.89fe2c05a990d962166d.js"></script><script type="text/javascript" src="/akasha.vendors.aa77836b5d4ffd4f96ac.js"></script><script type="text/javascript" src="/akasha.main.c2a17a194f5224a6cd66.js"></script></body>
<script type="text/javascript" src="/akasha.runtime.89fe2c05a990d962166d.js"></script><script type="text/javascript" src="/akasha.vendors.a8444420d8b3d463748d.js"></script><script type="text/javascript" src="/akasha.main.35624769ded7505bf023.js"></script></body>
</html>
11 changes: 9 additions & 2 deletions examples/ui/feed-app/webpack.config.js
Expand Up @@ -33,13 +33,20 @@ module.exports = {
],
},
plugins: [
new CopyPlugin([{ from: path.resolve(__dirname, '../../../ui/build') }, {
new CopyPlugin([{ from: path.resolve(__dirname, '../../../ui/build') },
{
from: path.resolve(__dirname, '../../../locales'),
to: 'locales',
}]),
}
]),
new HtmlWebpackPlugin({ template: path.resolve(__dirname, './public/index.html') }),
new webpack.HotModuleReplacementPlugin(),
],
// fix infinite loop of compilation when
// a new string is added to translations
watchOptions: {
ignored: [path.resolve(__dirname, '../../../locales'), 'node_modules'],
},
devServer: {
contentBase: './public',
historyApiFallback: true,
Expand Down
2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -22,6 +22,7 @@
"start:design-system:storybook": "lerna run storybook --scope @akashaproject/storybook --stream",
"pack:ui-apps": "lerna run pack --scope @akashaproject/ui-* --scope @akashaproject/design-* --stream",
"pack:only": "lerna run pack --scope $AWF_PACKAGE --stream",
"pack:watch": "lerna run pack:watch --scope $AWF_PACKAGE --stream",
"start:only": "lerna run start --scope $AWF_PACKAGE --stream",
"compile:sc": "lerna run compile:sc",
"deploy:sc": "lerna run deploy:sc",
Expand All @@ -46,6 +47,7 @@
"i18next-parser": "1.0.0-beta37",
"jest": "24.9.0",
"lerna": "3.19.0",
"nodemon": "^2.0.2",
"prettier": "1.19.1",
"pretty-quick": "2.0.1",
"react": "16.12.0",
Expand Down
8 changes: 7 additions & 1 deletion ui/design/package.json
Expand Up @@ -33,7 +33,13 @@
"tsc": "tsc --build",
"prepare": "npm run tsc",
"pack": "NODE_OPTIONS='--max-old-space-size=4096' webpack --config webpack.config.js",
"postpack": "copyfiles -f ./dist/*design-system.* ../build/"
"postpack": "copyfiles -f ./dist/*design-system.* ../build/",
"pack:watch": "nodemon"
},
"nodemonConfig": {
"ignore": ["lib/*", "dist/*", "build/*"],
"exec": "npm run pack",
"ext": "ts,tsx"
},
"eslintConfig": {
"extends": "react-app"
Expand Down
Expand Up @@ -11,7 +11,7 @@ export interface IIconButtonProps {
}

const StyledIconButton = styled(Button)<IIconButtonProps>`
height: 22px;
height: 1.375em;
border-radius: ${props => props.theme.shapes.largeBorderRadius};
border: none;
padding: 0 0.8em;
Expand Down
Expand Up @@ -19,7 +19,7 @@ const StyledIconLink = styled(Anchor)<ILinkIconButtonProps>`
}
svg {
height: 100%;
width: 20px;
width: 1.25em;
stroke: ${props => props.theme.colors.lightGrey};
& * {
stroke: ${props => props.theme.colors.secondaryText};
Expand Down
12 changes: 6 additions & 6 deletions ui/design/src/components/Cards/entry-cards/styled-entry-box.ts
Expand Up @@ -2,15 +2,15 @@ import { Box, Drop } from 'grommet';
import styled from 'styled-components';

const StyledLayerElemDiv = styled.div`
border-radius: ${props => props.theme.shapes.borderRadius}
padding: ${props => `${props.theme.shapes.baseSpacing * 3}px`}
border: 1px solid ${props => props.theme.colors.border}
margin-bottom: ${props => `${props.theme.shapes.baseSpacing * 3}px`}
border-radius: ${props => props.theme.shapes.borderRadius};
padding: ${props => `${props.theme.shapes.baseSpacing * 3}px`};
border: 1px solid ${props => props.theme.colors.border};
margin-bottom: ${props => `${props.theme.shapes.baseSpacing * 3}px`};
`;

const StyledDrop = styled(Drop)`
margin-top: -10px;
margin-left: 25px;
margin-top: -0.625em;
margin-left: 1.563em;
border-radius: ${props => props.theme.shapes.smallBorderRadius};
`;

Expand Down
Expand Up @@ -56,12 +56,12 @@ const ProfileWidgetCard: React.FC<IProfileWidgetCard> = props => {
return (
<BasicCardBox className={className}>
<Box
height="88px"
height="5.5em"
background={profileData.coverImage}
pad="none"
round={{ corner: 'top', size: 'xsmall' }}
/>
<Box height="56px" direction="row" pad={{ left: '14px', right: 'medium' }}>
<Box height="3.5em" direction="row" pad={{ left: '.875em', right: 'medium' }}>
<AvatarDiv>
<Avatar
withBorder={true}
Expand All @@ -81,7 +81,7 @@ const ProfileWidgetCard: React.FC<IProfileWidgetCard> = props => {
</Box>
</Box>
<Box
height="72px"
height="4.5em"
border={{ color: 'border', size: 'xsmall', style: 'solid', side: 'bottom' }}
margin={{ horizontal: 'medium' }}
direction="row"
Expand Down
Expand Up @@ -49,7 +49,7 @@ const CommentInput: React.FC<ICommentInput> = props => {
fill="horizontal"
direction="row"
align="center"
height="40px"
height="2.5em"
pad={{ horizontal: 'small', vertical: 'xsmall' }}
round="small"
border={{
Expand Down
Expand Up @@ -24,7 +24,7 @@ const SearchInputApps: React.FC<ISearchInputAppsProps> = props => {
onClick={() => onClickApp(name)}
key={index}
round={{ size: 'xxsmall' }}
height="40px"
height="2.5em"
justify="center"
>
<Box
Expand All @@ -37,7 +37,7 @@ const SearchInputApps: React.FC<ISearchInputAppsProps> = props => {
horizontal: 'small',
}}
>
<Image width="32px" height="32px" src={imageUrl} style={{ borderRadius: '100%' }} />
<Image width="2em" height="2em" src={imageUrl} style={{ borderRadius: '100%' }} />
<Text size="large">{name}</Text>
</Box>
</StyledSelectBox>
Expand Down
Expand Up @@ -24,7 +24,7 @@ const SearchInputTags: React.FC<ISearchInputTagsProps> = props => {
onClick={() => onClickTag(tag)}
key={index}
round={{ size: 'xxsmall' }}
height="40px"
height="2.5em"
justify="center"
>
<Box
Expand Down
Expand Up @@ -24,7 +24,7 @@ const SearchInputUsers: React.FC<ISearchInputUsersProps> = props => {
onClick={() => onClickUser(name)}
key={index}
round={{ size: 'xxsmall' }}
height="40px"
height="2.5em"
justify="center"
>
<Box
Expand All @@ -37,7 +37,7 @@ const SearchInputUsers: React.FC<ISearchInputUsersProps> = props => {
horizontal: 'small',
}}
>
<Image width="32px" height="32px" src={imageUrl} style={{ borderRadius: '100%' }} />
<Image width="2em" height="2em" src={imageUrl} style={{ borderRadius: '100%' }} />
<Text size="large">{name}</Text>
</Box>
</StyledSelectBox>
Expand Down
Expand Up @@ -18,13 +18,13 @@ const StyledSelectBox = styled(Box)<BoxProps>`
`;

const StyledDrop = styled(Drop)<DropProps>`
margin-top: 5px;
margin-top: 0.313em;
border-radius: ${props => props.theme.shapes.largeBorderRadius};
`;

const StyledTextInput = styled(TextInput)<TextInputProps>`
padding: 0;
height: 23px;
height: 1.438em;
${props => css`
font-family: ${props.theme.shapes.fontFamily};
Expand Down Expand Up @@ -58,7 +58,7 @@ const StyledTab = styled(Tab)<TabProps>`
margin: 0;
border-bottom: 1px solid ${props.theme.colors.lightGrey};
text-align: center;
padding: 12px 0;
padding: 0.75em 0;
> span {
font-family: ${props.theme.shapes.fontFamily};
Expand Down
4 changes: 2 additions & 2 deletions ui/design/src/components/Modals/list/list-modal.tsx
Expand Up @@ -49,9 +49,9 @@ const ListModal: React.FC<IlistModal> = props => {
};
return (
<StyledLayer onEsc={closeModal} onClickOutside={closeModal} modal={true} className={className}>
<Box pad="none" width="579px" height="386px">
<Box pad="none" width="36em" height="24em">
<Box pad="medium" justify="between" direction="row" align="center">
<TextIcon iconType={iconType} label={label} margin={{ right: '40px' }} />
<TextIcon iconType={iconType} label={label} margin={{ right: '2.5em' }} />
<Text size="large" color="secondaryText">
{secondaryLabel}
</Text>
Expand Down
28 changes: 14 additions & 14 deletions ui/design/src/components/Popovers/emoji/styled-emoji-popover.ts
Expand Up @@ -2,7 +2,7 @@ import { Box, Drop, Text } from 'grommet';
import styled from 'styled-components';

const StyledContentDiv = styled.div`
height: 200px;
height: 12.5em;
overflow: auto;
display: flex;
flex-direction: column;
Expand All @@ -16,22 +16,22 @@ const StyledList = styled.div`

const StyledListElem = styled.span`
cursor: pointer;
font-size: 20px;
width: 32px;
height: 32px;
font-size: 1.25em;
width: 2em;
height: 2em;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
border-radius: ${props => props.theme.shapes.smallBorderRadius}
border-radius: ${props => props.theme.shapes.smallBorderRadius};
:hover {
background-color: rgba(78,113,255,0.2);
background-color: rgba(78, 113, 255, 0.2);
}
`;

const StyledFooter = styled(Box)`
background-color: ${props => props.theme.colors.lightBackground};
height: 56px;
height: 3.5em;
`;

const StyledCategoryContainer = styled.div`
Expand All @@ -41,23 +41,23 @@ const StyledCategoryContainer = styled.div`

const StyledSearchContainer = styled.div`
margin: ${props => `${props.theme.shapes.baseSpacing}px ${props.theme.shapes.baseSpacing * 3}px`};
height: 48px;
height: 3em;
`;

const StyledEmojiDrop = styled(Drop)`
width: 350px;
margin-top: 5px;
margin-left: -25px;
width: 21.875em;
margin-top: 0.313em;
margin-left: -1.563em;
border-radius: ${props => props.theme.shapes.largeBorderRadius};
`;

const StyledHoveredEmoji = styled.div`
padding: ${props => `0 ${props.theme.shapes.baseSpacing * 3}px`}
font-size: 20px;
padding: ${props => `0 ${props.theme.shapes.baseSpacing * 3}px`};
font-size: 1.25em;
`;

const StyledHoveredEmojiName = styled.div`
padding: ${props => `0 ${props.theme.shapes.baseSpacing * 3}px 0 0`}
padding: ${props => `0 ${props.theme.shapes.baseSpacing * 3}px 0 0`};
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
Expand Down
18 changes: 9 additions & 9 deletions ui/design/src/components/Popovers/image/styled-image-popover.ts
Expand Up @@ -2,15 +2,15 @@ import { Button, Drop, Tab, Text } from 'grommet';
import styled, { css } from 'styled-components';

const StyledDrop = styled(Drop)`
height: 220px;
width: 350px;
margin-top: 5px;
height: 13.75em;
width: 21.875em;
margin-top: 0.313em;
border-radius: ${props => props.theme.shapes.largeBorderRadius};
`;

const StyledInputDiv = styled.div`
height: 130px;
width: 318px;
height: 8.125em;
width: 19.875em;
background-color: ${props => props.theme.colors.lightBackground};
border: 1px dashed ${props => props.theme.colors.mediumGrey};
border-radius: ${props => props.theme.shapes.borderRadius};
Expand All @@ -21,7 +21,7 @@ const StyledInputDiv = styled.div`
`;

const StyledText = styled(Text)`
padding: 0 50px;
padding: 0 3.125em;
text-align: center;
`;

Expand All @@ -35,8 +35,8 @@ const StyledImageInput = styled.input`
`;

const StyledImg = styled.img`
height: 48px;
width: 48px;
height: 3em;
width: 3em;
`;

const StyledTab = styled(Tab)`
Expand All @@ -47,7 +47,7 @@ const StyledTab = styled(Tab)`
margin: 0;
border-bottom: 1px solid ${props.theme.colors.border};
text-align: center;
padding: 12px 0;
padding: 0.75em 0;
> span {
font-family: ${props.theme.shapes.fontFamily};
Expand Down
Expand Up @@ -23,7 +23,12 @@ export interface INotification {
const NotificationsPopover: React.FC<INotificationsPopover> = props => {
const { className, closePopover, dataSource, onClickNotification, target } = props;
return (
<BasicPopover closePopover={closePopover} target={target} gap={'-5px'} className={className}>
<BasicPopover
closePopover={closePopover}
target={target}
gap={'-0.313em'}
className={className}
>
<StyledListContainer pad={{ vertical: 'small', horizontal: 'xxsmall' }} overflow="scroll">
{dataSource &&
dataSource.map((notification, index) => (
Expand Down
Expand Up @@ -19,7 +19,7 @@ const StyledListElem = styled.div`
cursor: pointer;
}
border-radius: ${props.theme.shapes.borderRadius}
height: 49px;
height: 3em;
display: flex;
align-items: center;
`}
Expand Down
2 changes: 1 addition & 1 deletion ui/design/src/components/Spinner/index.tsx
Expand Up @@ -6,7 +6,7 @@ const Wrapper = styled.div<{ minHeight: number }>`
display: flex;
min-height: ${props => props.minHeight}px;
justify-content: center;
padding: 10px 0 0 0;
padding: 0.625em 0 0 0;
`;

const rotator = keyframes`
Expand Down
Expand Up @@ -7,8 +7,8 @@ export interface IIconDiv {

const IconDiv = styled.div<IIconDiv>`
${props => {
const size = props.iconSize ? props.iconSize : '28px';
const radius = props.iconSize ? '100%' : '14px';
const size = props.iconSize ? props.iconSize : '1.75em';
const radius = props.iconSize ? '100%' : '0.875em';
return css`
border-radius: ${radius};
width: ${size};
Expand Down
Expand Up @@ -23,7 +23,7 @@ const StyledTextIcon = styled.div<ITextIconProps>`
return css`
& > *:first-child {
margin-right: ${spacing ? spacing : '10px'};
margin-right: ${spacing ? spacing : '0.625em'};
}
background-color: ${backgroundColor ? backgroundColor : ''};
color: ${color ? color : colors.dark};
Expand Down

0 comments on commit 8ce113e

Please sign in to comment.