//
//  KBGuideUserCell.m
//  keyBoard
//

#import "KBGuideUserCell.h"

@interface KBGuideUserCell ()
@property (nonatomic, strong) UIView *bubbleView;   // 右侧紫色气泡
@property (nonatomic, strong) UILabel *contentLabel;
@end

@implementation KBGuideUserCell

- (void)setupUI {
    self.contentView.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0];

    [self.contentView addSubview:self.bubbleView];
    [self.bubbleView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).offset(-16);
        make.top.equalTo(self.contentView).offset(8);
        make.left.greaterThanOrEqualTo(self.contentView).offset(80);
        make.bottom.equalTo(self.contentView).offset(-8);
    }];

    [self.bubbleView addSubview:self.contentLabel];
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.bubbleView).insets(UIEdgeInsetsMake(8, 10, 8, 10));
    }];
}

- (void)configText:(NSString *)text {
    self.contentLabel.text = text;
}

#pragma mark - Lazy

- (UIView *)bubbleView {
    if (!_bubbleView) {
        _bubbleView = [UIView new];
        _bubbleView.backgroundColor = [UIColor colorWithRed:0.42 green:0.45 blue:0.98 alpha:1.0];
        _bubbleView.layer.cornerRadius = 12;
        _bubbleView.layer.masksToBounds = YES;
    }
    return _bubbleView;
}

- (UILabel *)contentLabel {
    if (!_contentLabel) {
        _contentLabel = [UILabel new];
        _contentLabel.numberOfLines = 0;
        _contentLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
        _contentLabel.textColor = [UIColor whiteColor];
        _contentLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _contentLabel;
}

@end

