Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.8.2 #794

Merged
merged 38 commits into from
Nov 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7d88040
event card stories
caiokf Nov 4, 2019
746ae8c
text component stories
caiokf Nov 4, 2019
22608e4
fixing capitalize prop on text component
caiokf Nov 4, 2019
d09856d
adding description to pre-defined style props
caiokf Nov 4, 2019
537a1e9
heading stories
caiokf Nov 5, 2019
f623721
icon stories
caiokf Nov 14, 2019
8ee065e
adding a cursor pointer to an icon when it has an onClick function
caiokf Nov 14, 2019
cb6b90c
creating some default icon sizes
caiokf Nov 14, 2019
8623ee0
adding list of available glyph strings
caiokf Nov 14, 2019
d9cadb7
Adding workspace type to UserProfile page
drydenwilliams Nov 15, 2019
fd708a6
Merge branch 'master' into 768-updating-workspace-type
BenGamma Nov 15, 2019
469bf1b
Merge pull request #771 from ONEARMY/768-updating-workspace-type
BenGamma Nov 15, 2019
1ccd0cc
Moved workspace functions + map_icons
Nov 16, 2019
d24a7ff
Added user fallback icon
Nov 17, 2019
5b12e73
fixing types
caiokf Nov 17, 2019
da4da44
Merge pull request #743 from ONEARMY/storybook-components
BenGamma Nov 17, 2019
f8b05eb
change map zoom algorithm (less clustering)
chrismclarke Nov 17, 2019
17a938c
Removing blog from nav
drydenwilliams Nov 18, 2019
01a001b
Update index.tsx
Nov 18, 2019
6853e6c
Update index.tsx
Nov 18, 2019
7d5a76d
Set link size to fit content, changed a tag to link component
benjdelt Nov 20, 2019
7cac276
Fixed missing To attribute
benjdelt Nov 20, 2019
39e7c99
Changed Link back to anchor tag
benjdelt Nov 20, 2019
e94454e
Adding official logo
drydenwilliams Nov 21, 2019
2dd1922
Refactoring logo
drydenwilliams Nov 21, 2019
922f8f3
use only profile badge in Avatar component - remove useless states - …
BenGamma Nov 22, 2019
ac77eef
Merge pull request #782 from ONEARMY/775-display-user-badge
BenGamma Nov 22, 2019
ff3bad0
Merge pull request #783 from ONEARMY/fix/map-zoom
BenGamma Nov 22, 2019
2cd19be
remove useless import
BenGamma Nov 22, 2019
b34ee1e
Merge pull request #784 from ONEARMY/removing-blob-from-nav
BenGamma Nov 22, 2019
3e6e82f
update settings guidelines text & focus section button
BenGamma Nov 23, 2019
6a9752b
Merge pull request #792 from ONEARMY/785_improve_settings_guidelines
BenGamma Nov 23, 2019
335acea
update Cypress command toggleUserMenuOn to fit the new Avatar component
BenGamma Nov 24, 2019
aef0e39
wrap link in syled-component container
BenGamma Nov 24, 2019
43acc14
Merge branch 'master' into 779_resize-how-to-file-links
BenGamma Nov 24, 2019
002e836
Merge pull request #793 from ONEARMY/779_resize-how-to-file-links
BenGamma Nov 24, 2019
8c7580e
update version number v0.8.2
BenGamma Nov 24, 2019
fd8290a
Merge branch 'master' of https://github.com/ONEARMY/community-platform
BenGamma Nov 24, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ const attachCustomCommands = (Cypress, fb: typeof firebase) => {
},
})
return firestore.updateDocument(collectionName, docId, docData)

},
)

Expand Down Expand Up @@ -194,9 +193,7 @@ const attachCustomCommands = (Cypress, fb: typeof firebase) => {

Cypress.Commands.add('toggleUserMenuOn', () => {
Cypress.log({ displayName: 'OPEN_USER_MENU' })
cy.get('[data-cy=user-menu]')
.find('path')
.should('be.exist')
cy.get('[data-cy=user-menu]').should('be.exist')
cy.get('[data-cy=user-menu]').click()
})

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "precious-plastic-community-plateform",
"version": "0.8.1",
"version": "0.8.2",
"private": true,
"dependencies": {
"@babel/core": "7.2.2",
Expand Down
1 change: 1 addition & 0 deletions src/assets/images/precious-plastic-logo-official.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 17 additions & 31 deletions src/components/Avatar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
import React from 'react'

import { Image, ImageProps } from 'rebass'
import Icon from 'src/components/Icons'
import { inject, observer } from 'mobx-react'
import { UserStore, getUserAvatar } from 'src/stores/User/user.store'
import { ProfileTypeLabel } from 'src/models/user_pp.models'
import Workspace from 'src/pages/User/workspace/Workspace'

interface IProps extends ImageProps {
width?: string
userName: string
}

interface IInjected extends IProps {
userStore: UserStore
profileType?: ProfileTypeLabel
}

interface IState {
avatarUrl?: string
showFallback?: boolean
badgeProfileType?: string
}

@inject('userStore')
Expand All @@ -26,40 +22,30 @@ export class Avatar extends React.Component<IProps, IState> {
super(props)
this.state = {}
}
get injected() {
return this.props as IInjected
}

// subscribe/unsubscribe from specific user profile message when
// user updates their avatar (same url so by default will now be aware of change)
componentDidMount() {
this.getAvatar(this.props.userName)
this.getProfileTypeBadge(this.props.profileType)
}

async getAvatar(userName: string) {
const url = getUserAvatar(userName)
console.log('avatar', url)
this.setState({ avatarUrl: url })
public getProfileTypeBadge(type?: ProfileTypeLabel) {
const img = Workspace.findWorkspaceBadge(type, true)
this.setState({ badgeProfileType: img })
}

render() {
const { width } = this.props
const { showFallback, avatarUrl } = this.state
const { badgeProfileType } = this.state

return (
<>
{showFallback && <Icon glyph={'account-circle'} size={50} />}
{!showFallback && avatarUrl && (
<Image
className="avatar"
width={width ? width : 40}
sx={{ borderRadius: '25px' }}
src={avatarUrl}
onError={() => {
// if user image doesn't exist show fallback image instead
this.setState({ showFallback: true })
}}
/>
)}
<Image
className="avatar"
width={width ? width : 40}
height={width ? width : 40}
sx={{ borderRadius: '25px' }}
src={badgeProfileType}
/>
</>
)
}
Expand Down
77 changes: 77 additions & 0 deletions src/components/EventCard/event.card.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { withKnobs, text } from '@storybook/addon-knobs'
import { PropsTable } from '@storybook/components'
import { Story, Meta, Preview } from '@storybook/addon-docs/blocks'
import { EventCard } from './EventCard.tsx'

<Meta
title="Components|EventCard"
component={EventCard}
decorators={[withKnobs]}
/>

# Event Cards

Below you will be able to see how to use and configure a `EventCard` component:

<Preview>
<Story name="Default Event Card">
<EventCard
event={{
_createdBy: text('Created By', 'John Doe'),
slug: 'event-slug',
url: text('URL', ''),
date: Date.now(),
title: text('Title', 'Lighten the Black Sea'),
location: {
name: text('Location Name', 'Odessa'),
countryCode: text('Country Code', 'UKR'),
},
}}
/>
</Story>
</Preview>

<br />
<br />

## Props

The `EventCard` component receives an `event` prop, an object containing the fields below:

<PropsTable
rows={[
{
name: '_createdBy',
description: 'Name of the creator of the event.',
},
{
name: 'slug',
description: 'Event slug. Used as the key to render the react component.',
},
{
name: 'url',
required: true,
description: 'Url to where the "Go to event" link will take the user.',
},
{
name: 'date',
required: true,
description: 'Date object. Date in which the event will occur.',
},
{
name: 'title',
required: true,
description: 'Event title.',
},
{
name: 'location.name',
required: true,
description: 'Location where the event will take place',
},
{
name: 'location.countryCode',
required: true,
description: 'Country code',
},
]}
/>
13 changes: 11 additions & 2 deletions src/components/FileInfo/FileInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { availableGlyphs } from '../Icons'
import { bytesToSize } from '../ImageInput/ImageInput'
import { IUploadedFileMeta } from 'src/stores/storage'
import { FileDetails } from './FileDetails'
import styled from 'styled-components'

interface IProps {
file: File | IUploadedFileMeta | null
Expand All @@ -13,6 +14,10 @@ interface IState {
size: string
}

const FileContainer = styled.a`
width: 300px;
`

export class FileInfo extends React.Component<IProps, IState> {
constructor(props: IProps) {
super(props)
Expand Down Expand Up @@ -46,9 +51,13 @@ export class FileInfo extends React.Component<IProps, IState> {
return (
<>
{allowDownload && meta.downloadUrl ? (
<a href={meta.downloadUrl} target="_blank" download={file.name}>
<FileContainer
href={meta.downloadUrl}
target="_blank"
download={file.name}
>
<FileDetails file={file} glyph={glyph} size={size} />
</a>
</FileContainer>
) : (
<FileDetails file={file} glyph={glyph} size={size} />
)}
Expand Down
71 changes: 71 additions & 0 deletions src/components/Heading/heading.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { withKnobs, text, boolean } from '@storybook/addon-knobs'
import { PropsTable } from '@storybook/components'
import { Story, Meta, Preview } from '@storybook/addon-docs/blocks'
import Heading from './index.tsx'

<Meta title="Components|Heading" component={Heading} decorators={[withKnobs]} />

# Headings

A `Heading` component basically receives one of the props `small`, `medium` or `large`:

<Preview isColumn={true}>
<Story name="Small Heading">
<Heading small={true}>Lorem ipsum dolor sit amet</Heading>
</Story>
<Story name="Medium Heading">
<Heading medium={true}>Lorem ipsum dolor sit amet</Heading>
</Story>
<Story name="Large Heading">
<Heading large={true}>Lorem ipsum dolor sit amet</Heading>
</Story>
</Preview>

<br />
<br />

## Other Props

Props that can be applied to the `Heading` component:

<Story name="Default Heading" parameters={{ docs: { disable: true } }}>
<Heading
small={boolean('small', false)}
medium={boolean('medium', true)}
large={boolean('large', false)}
clipped={boolean('clipped', false)}
color={text('color', 'black')}
>
Lorem ipsum dolor sit amet.
</Heading>
</Story>

<PropsTable
rows={[
{
name: 'small',
defaultValue: false,
description: 'Sets a small font-size.',
},
{
name: 'medium',
defaultValue: false,
description: 'Sets a medium small font-size.',
},
{
name: 'large',
defaultValue: false,
description: 'Sets a large small font-size.',
},
{
name: 'clipped',
defaultValue: false,
description: 'Adds ellipsis while preventing text overflow.',
},
{
name: 'color',
defaultValue: 'black',
description: 'Font color.',
},
]}
/>
50 changes: 0 additions & 50 deletions src/components/Heading/heading.stories.tsx

This file was deleted.

Loading