mirror of
				https://github.com/owncast/owncast.git
				synced 2025-11-04 13:27:21 +08:00 
			
		
		
		
	* refactor: move/rename BanUserButton file * refactor: move/rename Chart file * refactor: update generic component filenames to PascalCase * refactor: update config component filenames to PascalCase * refactor: update AdminLayout component filename to PascalCase * refactor: update/move VideoJS component * chore(eslint): disable bad react/require-default-props rule * refactor: normalize ActionButton component * refactor: normalize ActionButtonRow component * refactor: normalize FollowButton component * refactor: normalize NotifyButton component * refactor: normalize ChatActionMessage component * refactor: normalize ChatContainer component * refactor: normalize ChatJoinMessage component * refactor: normalize ChatModerationActionMenu component * refactor: normalize ChatModerationDetailsModal component * refactor: normalize ChatModeratorNotification component * refactor: normalize ChatSocialMessage component * refactor: normalize ChatSystemMessage component * refactor: normalize ChatTextField component * refactor: normalize ChatUserBadge component * refactor: normalize ChatUserMessage component * refactor: normalize ContentHeader component * refactor: normalize OwncastLogo component * refactor: normalize UserDropdown component * chore(eslint): modify react/function-component-definition rule * refactor: normalize CodecSelector component * refactor: update a bunch of functional components using eslint * refactor: update a bunch of functional components using eslint, pt2 * refactor: update a bunch of functional components using eslint, pt3 * refactor: replace all component->component default imports with named imports * refactor: replace all component-stories->component default imports with named imports * refactor: remove default exports from most components * chore(eslint): add eslint config files for the components and pages dirs * fix: use-before-define error in ChatContainer * Fix ChatContainer import * Only process .tsx files in Next builds Co-authored-by: Gabe Kangas <gabek@real-ity.com>
		
			
				
	
	
		
			83 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			83 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import PropTypes from 'prop-types';
 | 
						|
import { FC } from 'react';
 | 
						|
 | 
						|
export type ColorProps = {
 | 
						|
  color: any; // TODO specify better type
 | 
						|
};
 | 
						|
 | 
						|
export const Color: FC<ColorProps> = ({ color }) => {
 | 
						|
  const resolvedColor = getComputedStyle(document.documentElement).getPropertyValue(`--${color}`);
 | 
						|
 | 
						|
  const containerStyle = {
 | 
						|
    borderRadius: '20px',
 | 
						|
    width: '12vw',
 | 
						|
    height: '12vw',
 | 
						|
    minWidth: '100px',
 | 
						|
    minHeight: '100px',
 | 
						|
    borderWidth: '1.5px',
 | 
						|
    borderStyle: 'solid',
 | 
						|
    borderColor: 'lightgray',
 | 
						|
    overflow: 'hidden',
 | 
						|
    margin: '0.3vw',
 | 
						|
  };
 | 
						|
 | 
						|
  const colorBlockStyle = {
 | 
						|
    display: 'flex',
 | 
						|
    justifyContent: 'center',
 | 
						|
    alignItems: 'center',
 | 
						|
    textShadow: '0 0 15px black',
 | 
						|
    height: '70%',
 | 
						|
    width: '100%',
 | 
						|
    backgroundColor: resolvedColor,
 | 
						|
  };
 | 
						|
 | 
						|
  const colorTextStyle = {
 | 
						|
    color: 'white',
 | 
						|
    alignText: 'center',
 | 
						|
  };
 | 
						|
 | 
						|
  const colorDescriptionStyle = {
 | 
						|
    margin: '5px',
 | 
						|
    color: 'gray',
 | 
						|
    fontSize: '0.95vw',
 | 
						|
    textAlign: 'center' as 'center',
 | 
						|
    lineHeight: 1.0,
 | 
						|
  };
 | 
						|
 | 
						|
  return (
 | 
						|
    <figure style={containerStyle}>
 | 
						|
      <div style={colorBlockStyle}>
 | 
						|
        <div style={colorTextStyle}>{resolvedColor}</div>
 | 
						|
      </div>
 | 
						|
      <figcaption style={colorDescriptionStyle}>{color}</figcaption>
 | 
						|
    </figure>
 | 
						|
  );
 | 
						|
};
 | 
						|
 | 
						|
Color.propTypes = {
 | 
						|
  color: PropTypes.string.isRequired,
 | 
						|
};
 | 
						|
 | 
						|
const rowStyle = {
 | 
						|
  display: 'flex',
 | 
						|
  flexDirection: 'row' as 'row',
 | 
						|
  flexWrap: 'wrap' as 'wrap',
 | 
						|
  alignItems: 'center',
 | 
						|
};
 | 
						|
 | 
						|
export const ColorRow = props => {
 | 
						|
  const { colors } = props;
 | 
						|
 | 
						|
  return (
 | 
						|
    <div style={rowStyle}>
 | 
						|
      {colors.map(color => (
 | 
						|
        <Color key={color} color={color} />
 | 
						|
      ))}
 | 
						|
    </div>
 | 
						|
  );
 | 
						|
};
 | 
						|
 | 
						|
ColorRow.propTypes = {
 | 
						|
  colors: PropTypes.arrayOf(PropTypes.string).isRequired,
 | 
						|
};
 |