-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make proposal list sections collapsible
- Loading branch information
Showing
8 changed files
with
77 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,22 @@ | ||
import React from "react"; | ||
import {Image, Text, View} from "@nodegui/react-nodegui"; | ||
import {AspectRatioMode} from "@nodegui/nodegui"; | ||
import {country} from "../../location/countries"; | ||
|
||
export type FlagProps = { | ||
base64: Buffer | ||
size: number | ||
} | ||
|
||
export const Flag: React.FC<FlagProps> = ({base64, size}) => { | ||
return ( | ||
<Image | ||
size={{ width: size, height: size }} | ||
style={`width: ${size}; height: ${size};`} | ||
aspectRatioMode={AspectRatioMode.KeepAspectRatio} | ||
buffer={base64}/> | ||
) | ||
} | ||
import {resolveCountry} from "../../location/countries"; | ||
import {ResolvedCountry} from "./resolved-country"; | ||
|
||
export type CountryProps = { | ||
code: string | ||
viewStyle?: string, | ||
textStyle?: string, | ||
flag: boolean | ||
containerStyle?: string | ||
textStyle?: string | ||
} | ||
|
||
export const Country: React.FC<CountryProps> = ({code, textStyle, viewStyle, flag}) => { | ||
const c = country(code) | ||
const flag64 = Buffer.from(c.flag, "base64") | ||
export const Country: React.FC<CountryProps> = (props) => { | ||
const c = resolveCountry(props.code) | ||
const flagBase64 = Buffer.from(c.flag, "base64") | ||
return ( | ||
<View style={` | ||
align-items: "center"; | ||
` + (viewStyle || '')}> | ||
{flag && ( | ||
<Flag size={24} base64={flag64}/> | ||
)} | ||
<Text style={` | ||
color: #eee; | ||
font-size: 12px; | ||
margin-left: 1px; | ||
` + (textStyle || '')}>{c.name}</Text> | ||
</View> | ||
|
||
<ResolvedCountry | ||
name={c.name} | ||
flagBase64={flagBase64} | ||
textStyle={props.textStyle} | ||
containerStyle={props.containerStyle} | ||
/> | ||
) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from "react"; | ||
import {Image} from "@nodegui/react-nodegui"; | ||
import {AspectRatioMode} from "@nodegui/nodegui"; | ||
|
||
export type FlagProps = { | ||
imageBase64: Buffer | ||
size: number | ||
} | ||
|
||
export const Flag: React.FC<FlagProps> = ({imageBase64, size}) => { | ||
return ( | ||
<Image | ||
size={{width: size, height: size}} | ||
style={`width: ${size}; height: ${size};`} | ||
aspectRatioMode={AspectRatioMode.KeepAspectRatio} | ||
buffer={imageBase64}/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from "react"; | ||
import {Text, View} from "@nodegui/react-nodegui"; | ||
import {Flag} from "./flag"; | ||
|
||
export type ResolvedCountryProps = { | ||
name: string | ||
flagBase64: Buffer | ||
containerStyle?: string | ||
textStyle?: string | ||
} | ||
|
||
export const ResolvedCountry: React.FC<ResolvedCountryProps> | ||
= ({name, flagBase64, containerStyle, textStyle}) => ( | ||
<View style={`align-items: "center"; ${containerStyle || ''}`}> | ||
<Flag size={24} imageBase64={flagBase64}/> | ||
<Text style={`color: #eee; font-size: 12px; margin-left: 1; ${textStyle || ''}`}>{name}</Text> | ||
</View> | ||
) |